File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/dial/junit/ArcDialFrameTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/PiePlotTests.java | |||
Method name: void testCloning()
|
Method name: void testCloning_LegendLabelToolTipGenerator()
|
|||
Number of AST nodes: 11 | Number of AST nodes: 11 | |||
1 | ArcDialFrame f1 = new ArcDialFrame();↵ | |||
2 | ArcDialFrame f↵ | 1 | StandardPieSectionLabelGenerator generator ↵ | |
2 | = new StandardPieSectionLabelGenerator();↵ | |||
3 | PiePlot p1 = new PiePlot();↵ | |||
4 | p1.setLegendLabelToolTipGenerator(generator);↵ | |||
3 | 2 = null;↵ | 5 | PiePlot p2 = null;↵ | |
4 | try {↵ | 6 | try {↵ | |
5 | f2 = (ArcDialFrame) f1.clone();↵ | 7 | p2 = (PiePlot) p1.clone();↵ | |
6 | }↵ | 8 | }↵ | |
7 | catch (CloneNotSupportedException e) {↵ | 9 | catch (CloneNotSupportedException e) {↵ | |
8 | e.printStackTrace();↵ | 10 | e.printStackTrace();↵ | |
9 | }↵ | 11 | }↵ | |
10 | assertTrue(f1 != f2);↵ | 12 | assertTrue(p1 != p2);↵ | |
11 | assertTrue(f1.getClass() == f2.getClass());↵ | 13 | assertTrue(p1.getClass() == p2.getClass());↵ | |
12 | assertTrue(f1.equals(f2));↵ | 14 | assertTrue(p1.equals(p2));↵ | |
13 | ↵ | 15 | ↵ | |
14 | // check that the listener lists are independent↵ | 16 | // ch↵ | |
15 | MyDialLayerChangeListener l1 = new MyDialLayerChangeListener();↵ | |||
16 | f1.addChangeListener(l1);↵ | |||
17 | assertTrue(f1.hasListener(l1)↵ | 17 | ange the generator and make sure it only affects p1↵ | |
18 | );↵ | 18 | generator.getNumberFormat().setMinimumFractionDigits(2);↵ | |
19 | assertFalse(f2.hasListener(l1)); | 19 | assertFalse(p1.equals(p2)); | |
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.1 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 72 |
Number of mapped statements | 7 |
Number of unmapped statements in the first code fragment | 4 |
Number of unmapped statements in the second code fragment | 4 |
Time elapsed for statement mapping (ms) | 80.8 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
| 1 | StandardPieSectionLabelGenerator generator = new StandardPieSectionLabelGenerator(); | |||||||||||||||||||||||||
1 | ArcDialFrame f1 = new ArcDialFrame(); |
| 2 | PiePlot p1 = new PiePlot(); | ||||||||||||||||||||||||
|
| 3 | p1.setLegendLabelToolTipGenerator(generator); | |||||||||||||||||||||||||
2 | ArcDialFrame f2 = null; |
| 4 | PiePlot p2 = null; | ||||||||||||||||||||||||
3 | try | 5 | try | |||||||||||||||||||||||||
4 | f2 = (ArcDialFrame)f1.clone(); |
| 6 | p2 = (PiePlot)p1.clone(); | ||||||||||||||||||||||||
5 | assertTrue(f1 != f2); |
| 7 | assertTrue(p1 != p2); | ||||||||||||||||||||||||
6 | assertTrue(f1.getClass() == f2.getClass()); |
| 8 | assertTrue(p1.getClass() == p2.getClass()); | ||||||||||||||||||||||||
7 | assertTrue(f1.equals(f2)); |
| 9 | assertTrue(p1.equals(p2)); | ||||||||||||||||||||||||
8 | MyDialLayerChangeListener l1 = new MyDialLayerChangeListener(); | | ||||||||||||||||||||||||||
9 | f1.addChangeListener(l1); |
| | |||||||||||||||||||||||||
| 10 | generator.getNumberFormat().setMinimumFractionDigits(2); | ||||||||||||||||||||||||||
10 | assertTrue(f1.hasListener(l1)); |
| | |||||||||||||||||||||||||
|
| 11 | assertFalse(p1.equals(p2)); | |||||||||||||||||||||||||
11 | assertFalse(f2.hasListener(l1)); |
| |
Row | Violation |
---|---|
1 | Unmatched statement StandardPieSectionLabelGenerator generator=new StandardPieSectionLabelGenerator(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Expression new ArcDialFrame() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression new PiePlot() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement p1.setLegendLabelToolTipGenerator(generator); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Expression (ArcDialFrame)f1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression (PiePlot)p1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression f2 cannot be unified with expression p2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public boolean equals(java.lang.Object) |
8 | Expression f2 cannot be unified with expression p2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object) |
9 | Expression f1 cannot be unified with expression p1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object) |
10 | Unmatched statement f1.addChangeListener(l1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
11 | Unmatched statement assertTrue(f1.hasListener(l1)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
12 | Unmatched statement assertFalse(p1.equals(p2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
13 | Unmatched statement assertFalse(f2.hasListener(l1)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
14 | Clone fragment #1 returns variables f1, f2 , while Clone fragment #2 returns variables p1, p2 |