File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/DateTickTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/xy/junit/XYLine3DRendererTests.java | |||
Method name: void testCloning()
|
Method name: void testCloning()
|
|||
Number of AST nodes: 7 | Number of AST nodes: 8 | |||
1 | DateTick t1 = new DateTick(↵ | |||
2 | new Date(0L), "Label", TextAnchor.CENTER, TextAnchor.CENTER, 10.0↵ | |||
3 | );↵ | |||
4 | DateTick t↵ | 1 | XYLine3DRenderer r1 = new XYLine3DRenderer();↵ | |
2 | r1.setWallPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f,↵ | |||
3 | Color.blue));↵ | |||
5 | 2 = null;↵ | 4 | XYLine3DRenderer r2 = null;↵ | |
6 | try {↵ | 5 | try {↵ | |
7 | t2 = (DateTick) t1.clone();↵ | 6 | r2 = (XYLine3DRenderer) r1.clone();↵ | |
8 | }↵ | 7 | }↵ | |
9 | catch (CloneNotSupportedException e) {↵ | 8 | catch (CloneNotSupportedException e) {↵ | |
10 | System.err.println("Failed to clone.");↵ | 9 | e.printStackTrace();↵ | |
11 | }↵ | 10 | }↵ | |
12 | assertTrue(t1 != t2);↵ | 11 | assertTrue(r1 != r2);↵ | |
13 | assertTrue(t1.getClass() == t2.getClass());↵ | 12 | assertTrue(r1.getClass() == r2.getClass());↵ | |
14 | assertTrue(t1.equals(t2)); | 13 | assertTrue(r1.equals(r2)); | |
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.3 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 34 |
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 4 |
Time elapsed for statement mapping (ms) | 5.3 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
| 1 | XYLine3DRenderer r1 = new XYLine3DRenderer(); | ||||||||||||||||||||||||
1 | DateTick t1 = new DateTick(new Date(0L), "Label", TextAnchor.CENTER, TextAnchor.CENTER, 10.0); |
| | ||||||||||||||||||||||||
|
| 2 | r1.setWallPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue)); | ||||||||||||||||||||||||
2 | DateTick t2 = null; | | |||||||||||||||||||||||||
| 3 | XYLine3DRenderer r2 = null; | |||||||||||||||||||||||||
3 | try |
| 4 | try | |||||||||||||||||||||||
4 | t2 = (DateTick)t1.clone(); |
| | ||||||||||||||||||||||||
|
| 5 | r2 = (XYLine3DRenderer)r1.clone(); | ||||||||||||||||||||||||
5 | assertTrue(t1 != t2); |
| 6 | assertTrue(r1 != r2); | |||||||||||||||||||||||
6 | assertTrue(t1.getClass() == t2.getClass()); |
| 7 | assertTrue(r1.getClass() == r2.getClass()); | |||||||||||||||||||||||
7 | assertTrue(t1.equals(t2)); |
| 8 | assertTrue(r1.equals(r2)); |
Row | Violation |
---|---|
1 | Unmatched statement XYLine3DRenderer r1=new XYLine3DRenderer(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Unmatched statement DateTick t1=new DateTick(new Date(0L),"Label",TextAnchor.CENTER,TextAnchor.CENTER,10.0); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
3 | Unmatched statement r1.setWallPaint(new GradientPaint(1.0f,2.0f,Color.red,3.0f,4.0f,Color.blue)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
4 | Expression e.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression System.err.println("Failed to clone.") is a void method call, and thus it cannot be parameterized |
6 | Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized |
7 | Expression e cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression e.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
9 | Expression System.err.println("Failed to clone.") is a void method call, and thus it cannot be parameterized |
10 | Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized |
11 | Unmatched statement t2=(DateTick)t1.clone(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |
12 | Unmatched statement r2=(XYLine3DRenderer)r1.clone(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |
13 | Type org.jfree.chart.axis.DateTick of variable t1 does not match with type org.jfree.chart.renderer.xy.XYLine3DRenderer of variable r1 |
14 | Type org.jfree.chart.axis.DateTick of variable t2 does not match with type org.jfree.chart.renderer.xy.XYLine3DRenderer of variable r2 |
15 | Type org.jfree.chart.axis.DateTick of variable t1 does not match with type org.jfree.chart.renderer.xy.XYLine3DRenderer of variable r1 |
16 | Type org.jfree.chart.axis.DateTick of variable t2 does not match with type org.jfree.chart.renderer.xy.XYLine3DRenderer of variable r2 |
17 | Type org.jfree.chart.axis.DateTick of variable t2 does not match with type org.jfree.chart.renderer.xy.XYLine3DRenderer of variable r2 |
18 | Type org.jfree.chart.axis.DateTick of variable t1 does not match with type org.jfree.chart.renderer.xy.XYLine3DRenderer of variable r1 |