File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/junit/DefaultPolarItemRendererTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/IntervalXYDelegateTests.java | |||
Method name: void testCloning()
|
Method name: void testCloning()
|
|||
Number of AST nodes: 11 | Number of AST nodes: 11 | |||
1 | DefaultPolarItemRenderer r1 = new DefaultPolarItemRenderer();↵ | |||
2 | DefaultPolarItemRenderer r↵ | 1 | XYSeries s1 = new XYSeries("Series");↵ | |
2 | s1.add(1.2, 3.4);↵ | |||
3 | XYSeriesCollection c1 = new XYSeriesCollection();↵ | |||
4 | c1.addSeries(s1);↵ | |||
5 | IntervalXYDelegate d1 = new IntervalXYDelegate(c1);↵ | |||
6 | ↵ | |||
3 | 2 = null;↵ | 7 | IntervalXYDelegate d2 = null;↵ | |
4 | try {↵ | 8 | try {↵ | |
5 | r2 = (DefaultPolarItemRenderer) r1.clone();↵ | 9 | d2 = (IntervalXYDelegate) d1.clone();↵ | |
6 | }↵ | 10 | }↵ | |
7 | catch (CloneNotSupportedException e) {↵ | 11 | catch (CloneNotSupportedException e) {↵ | |
8 | e.printStackTrace();↵ | 12 | System.err.println("Failed to clone.");↵ | |
9 | }↵ | 13 | }↵ | |
10 | assertTrue(r1 != r2);↵ | 14 | assertTrue(d1 != d2);↵ | |
11 | assertTrue(r1.getClass() == r2.getClass());↵ | 15 | assertTrue(d1.getClass() == d2.getClass());↵ | |
12 | assertTrue(r1.equals(r2));↵ | 16 | assertTrue(↵ | |
13 | ↵ | |||
14 | r1.setSeriesFilled(1, true);↵ | |||
15 | assertFalse(r1.equals(r2));↵ | |||
16 | r2.setSeriesFilled(1, true);↵ | |||
17 | assertTrue(r1.equals(r2)); | 17 | d1.equals(d2)); | |
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 | 85 |
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 7 |
Number of unmapped statements in the second code fragment | 7 |
Time elapsed for statement mapping (ms) | 7.8 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
| 1 | XYSeries s1 = new XYSeries("Series"); | ||||||||||||||||||||||||
1 | DefaultPolarItemRenderer r1 = new DefaultPolarItemRenderer(); |
| | ||||||||||||||||||||||||
|
| 2 | s1.add(1.2, 3.4); | ||||||||||||||||||||||||
2 | DefaultPolarItemRenderer r2 = null; | | |||||||||||||||||||||||||
|
| 3 | XYSeriesCollection c1 = new XYSeriesCollection(); | ||||||||||||||||||||||||
|
| 4 | c1.addSeries(s1); | ||||||||||||||||||||||||
|
| 5 | IntervalXYDelegate d1 = new IntervalXYDelegate(c1); | ||||||||||||||||||||||||
| 6 | IntervalXYDelegate d2 = null; | |||||||||||||||||||||||||
3 | try |
| 7 | try | |||||||||||||||||||||||
4 | r2 = (DefaultPolarItemRenderer)r1.clone(); |
| | ||||||||||||||||||||||||
|
| 8 | d2 = (IntervalXYDelegate)d1.clone(); | ||||||||||||||||||||||||
5 | assertTrue(r1 != r2); |
| 9 | assertTrue(d1 != d2); | |||||||||||||||||||||||
6 | assertTrue(r1.getClass() == r2.getClass()); |
| 10 | assertTrue(d1.getClass() == d2.getClass()); | |||||||||||||||||||||||
7 | assertTrue(r1.equals(r2)); | | |||||||||||||||||||||||||
8 | r1.setSeriesFilled(1, true); |
| | ||||||||||||||||||||||||
9 | assertFalse(r1.equals(r2)); | | |||||||||||||||||||||||||
10 | r2.setSeriesFilled(1, true); |
| | ||||||||||||||||||||||||
11 | assertTrue(r1.equals(r2)); |
| 11 | assertTrue(d1.equals(d2)); |
Row | Violation |
---|---|
1 | Unmatched statement XYSeries s1=new XYSeries("Series"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Unmatched statement DefaultPolarItemRenderer r1=new DefaultPolarItemRenderer(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
3 | Unmatched statement s1.add(1.2,3.4); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
4 | Unmatched statement XYSeriesCollection c1=new XYSeriesCollection(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
5 | Unmatched statement c1.addSeries(s1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
6 | Unmatched statement IntervalXYDelegate d1=new IntervalXYDelegate(c1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
7 | Expression e.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized |
9 | Expression System.err.println("Failed to clone.") is a void method call, and thus it cannot be parameterized |
10 | Expression e cannot be parameterized, because it has dependencies to/from statements that will be extracted |
11 | Expression e.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
12 | Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized |
13 | Expression System.err.println("Failed to clone.") is a void method call, and thus it cannot be parameterized |
14 | Unmatched statement r2=(DefaultPolarItemRenderer)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 |
15 | Unmatched statement d2=(IntervalXYDelegate)d1.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 |
16 | Type org.jfree.chart.renderer.DefaultPolarItemRenderer of variable r1 does not match with type org.jfree.data.xy.IntervalXYDelegate of variable d1 |
17 | Type org.jfree.chart.renderer.DefaultPolarItemRenderer of variable r2 does not match with type org.jfree.data.xy.IntervalXYDelegate of variable d2 |
18 | Type org.jfree.chart.renderer.DefaultPolarItemRenderer of variable r1 does not match with type org.jfree.data.xy.IntervalXYDelegate of variable d1 |
19 | Type org.jfree.chart.renderer.DefaultPolarItemRenderer of variable r2 does not match with type org.jfree.data.xy.IntervalXYDelegate of variable d2 |
20 | Unmatched statement r1.setSeriesFilled(1,true); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
21 | Unmatched statement r2.setSeriesFilled(1,true); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
22 | Type org.jfree.chart.renderer.DefaultPolarItemRenderer of variable r2 does not match with type org.jfree.data.xy.IntervalXYDelegate of variable d2 |
23 | Type org.jfree.chart.renderer.DefaultPolarItemRenderer of variable r1 does not match with type org.jfree.data.xy.IntervalXYDelegate of variable d1 |