File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/PiePlotTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/PiePlotTests.java | |||
Method name: void testCloning_LegendLabelGenerator()
|
Method name: void testCloning_LegendLabelToolTipGenerator()
|
|||
Number of AST nodes: 11 | Number of AST nodes: 11 | |||
1 | StandardPieSectionLabelGenerator generator ↵ | 1 | StandardPieSectionLabelGenerator generator ↵ | |
2 | = new StandardPieSectionLabelGenerator();↵ | 2 | = new StandardPieSectionLabelGenerator();↵ | |
3 | PiePlot p1 = new PiePlot();↵ | 3 | PiePlot p1 = new PiePlot();↵ | |
4 | p1.setLegendLabelGenerator(generator);↵ | 4 | p1.setLegendLabelToolTipGenerator(generator);↵ | |
5 | PiePlot p2 = null;↵ | 5 | PiePlot p2 = null;↵ | |
6 | try {↵ | 6 | try {↵ | |
7 | p2 = (PiePlot) p1.clone();↵ | 7 | p2 = (PiePlot) p1.clone();↵ | |
8 | }↵ | 8 | }↵ | |
9 | catch (CloneNotSupportedException e) {↵ | 9 | catch (CloneNotSupportedException e) {↵ | |
10 | e.printStackTrace();↵ | 10 | e.printStackTrace();↵ | |
11 | }↵ | 11 | }↵ | |
12 | assertTrue(p1 != p2);↵ | 12 | assertTrue(p1 != p2);↵ | |
13 | assertTrue(p1.getClass() == p2.getClass());↵ | 13 | assertTrue(p1.getClass() == p2.getClass());↵ | |
14 | assertTrue(p1.equals(p2));↵ | 14 | assertTrue(p1.equals(p2));↵ | |
15 | ↵ | 15 | ↵ | |
16 | // change the generator and make sure it only affects p1↵ | 16 | // change the generator and make sure it only affects p1↵ | |
17 | generator.getNumberFormat().setMinimumFractionDigits(2);↵ | 17 | generator.getNumberFormat().setMinimumFractionDigits(2);↵ | |
18 | assertFalse(p1.equals(p2)); | 18 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.1 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 45 |
Number of mapped statements | 11 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 45.2 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | StandardPieSectionLabelGenerator generator = new StandardPieSectionLabelGenerator(); | 1 | StandardPieSectionLabelGenerator generator = new StandardPieSectionLabelGenerator(); | |||||||||||||||
2 | PiePlot p1 = new PiePlot(); | 2 | PiePlot p1 = new PiePlot(); | |||||||||||||||
3 | p1.setLegendLabelGenerator(generator); |
| 3 | p1.setLegendLabelToolTipGenerator(generator); | ||||||||||||||
4 | PiePlot p2 = null; | 4 | PiePlot p2 = null; | |||||||||||||||
5 | try | 5 | try | |||||||||||||||
6 | p2 = (PiePlot)p1.clone(); | 6 | p2 = (PiePlot)p1.clone(); | |||||||||||||||
7 | assertTrue(p1 != p2); | 7 | assertTrue(p1 != p2); | |||||||||||||||
8 | assertTrue(p1.getClass() == p2.getClass()); | 8 | assertTrue(p1.getClass() == p2.getClass()); | |||||||||||||||
9 | assertTrue(p1.equals(p2)); | 9 | assertTrue(p1.equals(p2)); | |||||||||||||||
10 | generator.getNumberFormat().setMinimumFractionDigits(2); | 10 | generator.getNumberFormat().setMinimumFractionDigits(2); | |||||||||||||||
11 | assertFalse(p1.equals(p2)); | 11 | assertFalse(p1.equals(p2)); |
Row | Violation |
---|---|
1 | Expression p1.setLegendLabelGenerator(generator) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression p1.setLegendLabelToolTipGenerator(generator) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression p1.setLegendLabelGenerator(generator) is a void method call, and thus it cannot be parameterized |
4 | Expression p1.setLegendLabelToolTipGenerator(generator) is a void method call, and thus it cannot be parameterized |