File path: /jfreechart-1.0.10/tests/org/jfree/chart/annotations/junit/XYLineAnnotationTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/chart/entity/junit/XYItemEntityTests.java | |||
Method name: void testCloning()
|
Method name: void testCloning()
|
|||
Number of AST nodes: 8 | Number of AST nodes: 7 | |||
1 | Stroke stroke = new BasicStroke(2.0f);↵ | |||
2 | XYLineAnnotation a1 = new XYLineAnnotation↵ | 1 | XYItemEntity e1 = new XYItemEntity(↵ | |
3 | (10.0, 20.0, 100.0, 200.0,↵ | 2 | new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0),↵ | |
4 | stroke, Color.blue↵ | 3 | new TimeSeriesCollection(), 1, 9, "ToolTip", "URL"↵ | |
5 | );↵ | 4 | ); ↵ | |
6 | XYLineAnnotation a2 = null;↵ | 5 | XYItemEntity e2 = null;↵ | |
6 | ↵ | |||
7 | try {↵ | 7 | try {↵ | |
8 | a2 = (XYLineAnnotation) a1.clone();↵ | 8 | e2 = (XYItemEntity) e1.clone();↵ | |
9 | }↵ | 9 | }↵ | |
10 | catch (CloneNotSupportedException e) {↵ | 10 | catch (CloneNotSupportedException e) {↵ | |
11 | System.err.println("Failed to clone.");↵ | 11 | System.err.println("Failed to clone.");↵ | |
12 | }↵ | 12 | }↵ | |
13 | assertTrue(a1 != a2);↵ | 13 | assertTrue(e1 != e2);↵ | |
14 | assertTrue(a1.getClass() == a2.getClass());↵ | 14 | assertTrue(e1.getClass() == e2.getClass());↵ | |
15 | assertTrue(a1.equals(a2)); | 15 | assertTrue(e1.equals(e2)); | |
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.2 |
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 | 4 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 29.8 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Stroke stroke = new BasicStroke(2.0f); | | ||||||||||||||||||||||||||||||
2 | XYLineAnnotation a1 = new XYLineAnnotation(10.0, 20.0, 100.0, 200.0, stroke, Color.blue); |
| 2 | XYItemEntity e2 = null; | ||||||||||||||||||||||||||||
3 | XYLineAnnotation a2 = null; |
| 1 | XYItemEntity e1 = new XYItemEntity(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), new TimeSeriesCollection(), 1, 9, "ToolTip", "URL"); | ||||||||||||||||||||||||||||
4 | try | 3 | try | |||||||||||||||||||||||||||||
5 | a2 = (XYLineAnnotation)a1.clone(); |
| 4 | e2 = (XYItemEntity)e1.clone(); | ||||||||||||||||||||||||||||
|
| 5 | assertTrue(e1 != e2); | |||||||||||||||||||||||||||||
|
| 6 | assertTrue(e1.getClass() == e2.getClass()); | |||||||||||||||||||||||||||||
6 | assertTrue(a1 != a2); |
| | |||||||||||||||||||||||||||||
|
| 7 | assertTrue(e1.equals(e2)); | |||||||||||||||||||||||||||||
7 | assertTrue(a1.getClass() == a2.getClass()); |
| | |||||||||||||||||||||||||||||
8 | assertTrue(a1.equals(a2)); |
| |
Row | Violation |
---|---|
1 | Expression new XYLineAnnotation(10.0,20.0,100.0,200.0,stroke,Color.blue) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression new XYItemEntity(new Rectangle2D.Double(1.0,2.0,3.0,4.0),new TimeSeriesCollection(),1,9,"ToolTip","URL") cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression a2 cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression e2 cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression (XYLineAnnotation)a1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression (XYItemEntity)e1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression a1 cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression e1 cannot be parameterized, because it has dependencies to/from statements that will be extracted |
9 | Unmatched statement assertTrue(e1 != e2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
10 | Unmatched statement assertTrue(e1.getClass() == e2.getClass()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
11 | Unmatched statement assertTrue(a1 != a2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
12 | Unmatched statement assertTrue(e1.equals(e2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
13 | Unmatched statement assertTrue(a1.getClass() == a2.getClass()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
14 | Unmatched statement assertTrue(a1.equals(a2)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
15 | Clone fragment #1 returns variables a1, a2 , while Clone fragment #2 returns variables e1, e2 |