File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/CategoryAxisTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/ExtendedCategoryAxisTests.java | |||
Method name: void testCloning2()
|
Method name: void testCloning2()
|
|||
Number of AST nodes: 21 | Number of AST nodes: 21 | |||
1 | CategoryAxis a1 = new CategoryAxis("Test");↵ | 1 | ExtendedCategoryAxis a1 = new ExtendedCategoryAxis("Test");↵ | |
2 | a1.setTickLabelFont("C1", new Font("Dialog", Font.PLAIN, 15));↵ | 2 | a1.setTickLabelFont("C1", new Font("Dialog", Font.PLAIN, 15));↵ | |
3 | a1.setTickLabelPaint("C1", new GradientPaint(1.0f, 2.0f, Color.red, ↵ | 3 | a1.setTickLabelPaint("C1", new GradientPaint(1.0f, 2.0f, Color.red, ↵ | |
4 | 3.0f, 4.0f, Color.white));↵ | 4 | 3.0f, 4.0f, Color.white));↵ | |
5 | CategoryAxis a2 = null;↵ | 5 | ExtendedCategoryAxis a2 = null;↵ | |
6 | try {↵ | 6 | try {↵ | |
7 | a2 = (CategoryAxis) a1.clone();↵ | 7 | a2 = (ExtendedCategoryAxis) a1.clone();↵ | |
8 | }↵ | 8 | }↵ | |
9 | catch (CloneNotSupportedException e) {↵ | 9 | catch (CloneNotSupportedException e) {↵ | |
10 | System.err.println("Failed to clone.");↵ | 10 | e.printStackTrace();↵ | |
11 | }↵ | 11 | }↵ | |
12 | assertTrue(a1 != a2);↵ | 12 | assertTrue(a1 != a2);↵ | |
13 | assertTrue(a1.getClass() == a2.getClass());↵ | 13 | assertTrue(a1.getClass() == a2.getClass());↵ | |
14 | assertTrue(a1.equals(a2));↵ | 14 | assertTrue(a1.equals(a2));↵ | |
15 | ↵ | 15 | ↵ | |
16 | // check that changing a tick label font in a1 doesn't change a2↵ | 16 | // check that changing a tick label font in a1 doesn't change a2↵ | |
17 | a1.setTickLabelFont("C1", null);↵ | 17 | a1.setTickLabelFont("C1", null);↵ | |
18 | assertFalse(a1.equals(a2));↵ | 18 | assertFalse(a1.equals(a2));↵ | |
19 | a2.setTickLabelFont("C1", null);↵ | 19 | a2.setTickLabelFont("C1", null);↵ | |
20 | assertTrue(a1.equals(a2));↵ | 20 | assertTrue(a1.equals(a2));↵ | |
21 | ↵ | 21 | ↵ | |
22 | // check that changing a tick label paint in a1 doesn't change a2↵ | 22 | // check that changing a tick label paint in a1 doesn't change a2↵ | |
23 | a1.setTickLabelPaint("C1", Color.yellow);↵ | 23 | a1.setTickLabelPaint("C1", Color.yellow);↵ | |
24 | assertFalse(a1.equals(a2));↵ | 24 | assertFalse(a1.equals(a2));↵ | |
25 | a2.setTickLabelPaint("C1", Color.yellow);↵ | 25 | a2.setTickLabelPaint("C1", Color.yellow);↵ | |
26 | assertTrue(a1.equals(a2));↵ | 26 | assertTrue(a1.equals(a2));↵ | |
27 | // check that changing a category label tooltip in a1 doesn't change a2↵ | 27 | // check that changing a category label tooltip in a1 doesn't change a2↵ | |
28 | a1.addCategoryLabelToolTip("C1", "XYZ");↵ | 28 | a1.addCategoryLabelToolTip("C1", "XYZ");↵ | |
29 | assertFalse(a1.equals(a2));↵ | 29 | assertFalse(a1.equals(a2));↵ | |
30 | a2.addCategoryLabelToolTip("C1", "XYZ");↵ | 30 | a2.addCategoryLabelToolTip("C1", "XYZ");↵ | |
31 | assertTrue(a1.equals(a2)); | 31 |
| |
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.4 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 127 |
Number of mapped statements | 21 |
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) | 119.1 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | CategoryAxis a1 = new CategoryAxis("Test"); |
| 1 | ExtendedCategoryAxis a1 = new ExtendedCategoryAxis("Test"); | |||||||||||||||||||||||
2 | a1.setTickLabelFont("C1", new Font("Dialog", Font.PLAIN, 15)); |
| 2 | a1.setTickLabelFont("C1", new Font("Dialog", Font.PLAIN, 15)); | |||||||||||||||||||||||
3 | a1.setTickLabelPaint("C1", new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.white)); |
| 3 | a1.setTickLabelPaint("C1", new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.white)); | |||||||||||||||||||||||
4 | CategoryAxis a2 = null; |
| 4 | ExtendedCategoryAxis a2 = null; | |||||||||||||||||||||||
5 | try |
| 5 | try | |||||||||||||||||||||||
6 | a2 = (CategoryAxis)a1.clone(); |
| 6 | a2 = (ExtendedCategoryAxis)a1.clone(); | |||||||||||||||||||||||
7 | assertTrue(a1 != a2); |
| 7 | assertTrue(a1 != a2); | |||||||||||||||||||||||
8 | assertTrue(a1.getClass() == a2.getClass()); |
| 8 | assertTrue(a1.getClass() == a2.getClass()); | |||||||||||||||||||||||
9 | assertTrue(a1.equals(a2)); |
| 9 | assertTrue(a1.equals(a2)); | |||||||||||||||||||||||
10 | a1.setTickLabelFont("C1", null); |
| 10 | a1.setTickLabelFont("C1", null); | |||||||||||||||||||||||
11 | assertFalse(a1.equals(a2)); |
| 11 | assertFalse(a1.equals(a2)); | |||||||||||||||||||||||
12 | a2.setTickLabelFont("C1", null); |
| 12 | a2.setTickLabelFont("C1", null); | |||||||||||||||||||||||
13 | assertTrue(a1.equals(a2)); |
| 13 | assertTrue(a1.equals(a2)); | |||||||||||||||||||||||
14 | a1.setTickLabelPaint("C1", Color.yellow); |
| 14 | a1.setTickLabelPaint("C1", Color.yellow); | |||||||||||||||||||||||
15 | assertFalse(a1.equals(a2)); |
| 15 | assertFalse(a1.equals(a2)); | |||||||||||||||||||||||
16 | a2.setTickLabelPaint("C1", Color.yellow); |
| 16 | a2.setTickLabelPaint("C1", Color.yellow); | |||||||||||||||||||||||
17 | assertTrue(a1.equals(a2)); |
| 17 | assertTrue(a1.equals(a2)); | |||||||||||||||||||||||
18 | a1.addCategoryLabelToolTip("C1", "XYZ"); |
| 18 | a1.addCategoryLabelToolTip("C1", "XYZ"); | |||||||||||||||||||||||
19 | assertFalse(a1.equals(a2)); |
| 19 | assertFalse(a1.equals(a2)); | |||||||||||||||||||||||
20 | a2.addCategoryLabelToolTip("C1", "XYZ"); |
| 20 | a2.addCategoryLabelToolTip("C1", "XYZ"); | |||||||||||||||||||||||
21 | assertTrue(a1.equals(a2)); |
| 21 | assertTrue(a1.equals(a2)); |
Row | Violation |
---|---|
1 | Expression new CategoryAxis("Test") cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression new ExtendedCategoryAxis("Test") cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression e.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression System.err.println("Failed to clone.") is a void method call, and thus it cannot be parameterized |
5 | Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized |
6 | Expression e cannot be parameterized, because it has dependencies to/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 System.err.println("Failed to clone.") is a void method call, and thus it cannot be parameterized |
9 | Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized |
10 | Expression (CategoryAxis)a1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
11 | Expression (ExtendedCategoryAxis)a1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted |