File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/CategoryTickTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/DateTickTests.java | |||
Method name: void testCloning()
|
Method name: void testCloning()
|
|||
Number of AST nodes: 7 | Number of AST nodes: 7 | |||
1 | CategoryTick t1 = new CategoryTick(↵ | 1 | DateTick t1 = new DateTick(↵ | |
2 | "C1", new TextBlock(), TextBlockAnchor.CENTER, ↵ | 2 | new Date(0L), "Label", TextAnchor.CENTER, ↵ | |
3 | TextAnchor.CENTER, 1.5f↵ | 3 | TextAnchor.CENTER, 10.0↵ | |
4 | );↵ | 4 | );↵ | |
5 | CategoryTick t2 = null;↵ | 5 | DateTick t2 = null;↵ | |
6 | try {↵ | 6 | try {↵ | |
7 | t2 = (CategoryTick) t1.clone();↵ | 7 | t2 = (DateTick) t1.clone();↵ | |
8 | }↵ | 8 | }↵ | |
9 | catch (CloneNotSupportedException e) {↵ | 9 | catch (CloneNotSupportedException e) {↵ | |
10 | System.err.println("Failed to clone.");↵ | 10 | System.err.println("Failed to clone.");↵ | |
11 | }↵ | 11 | }↵ | |
12 | assertTrue(t1 != t2);↵ | 12 | assertTrue(t1 != t2);↵ | |
13 | assertTrue(t1.getClass() == t2.getClass());↵ | 13 | assertTrue(t1.getClass() == t2.getClass());↵ | |
14 | assertTrue(t1.equals(t2)); | 14 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 29 |
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 17.1 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | CategoryTick t1 = new CategoryTick("C1", new TextBlock(), TextBlockAnchor.CENTER, TextAnchor.CENTER, 1.5f); |
| 2 | DateTick t2 = null; | ||||||||||||||||||||
2 | CategoryTick t2 = null; |
| 1 | DateTick t1 = new DateTick(new Date(0L), "Label", TextAnchor.CENTER, TextAnchor.CENTER, 10.0); | ||||||||||||||||||||
3 | try | 3 | try | |||||||||||||||||||||
4 | t2 = (CategoryTick)t1.clone(); |
| 4 | t2 = (DateTick)t1.clone(); | ||||||||||||||||||||
|
| 5 | assertTrue(t1 != t2); | |||||||||||||||||||||
5 | assertTrue(t1 != t2); |
| | |||||||||||||||||||||
|
| 6 | assertTrue(t1.getClass() == t2.getClass()); | |||||||||||||||||||||
6 | assertTrue(t1.getClass() == t2.getClass()); |
| | |||||||||||||||||||||
|
| 7 | assertTrue(t1.equals(t2)); | |||||||||||||||||||||
7 | assertTrue(t1.equals(t2)); |
| |
Row | Violation |
---|---|
1 | Expression new CategoryTick("C1",new TextBlock(),TextBlockAnchor.CENTER,TextAnchor.CENTER,1.5f) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression new DateTick(new Date(0L),"Label",TextAnchor.CENTER,TextAnchor.CENTER,10.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression (CategoryTick)t1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression (DateTick)t1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Unmatched statement assertTrue(t1 != t2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Unmatched statement assertTrue(t1 != t2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
7 | Unmatched statement assertTrue(t1.getClass() == t2.getClass()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
8 | Unmatched statement assertTrue(t1.getClass() == t2.getClass()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
9 | Unmatched statement assertTrue(t1.equals(t2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
10 | Unmatched statement assertTrue(t1.equals(t2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
11 | Clone fragment #1 returns variables t1, t2 , while Clone fragment #2 returns variables t1, t2 |