File path: /jfreechart-1.0.10/tests/org/jfree/data/junit/KeyedObjects2DTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/MatrixSeriesCollectionTests.java | |||
Method name: void testCloning()
|
Method name: void testCloning()
|
|||
Number of AST nodes: 12 | Number of AST nodes: 12 | |||
1 | KeyedObjects2D o1 = new KeyedObjects2D();↵ | 1 | MatrixSeries s1 = new MatrixSeries("Series", 2, 3);↵ | |
2 | o1.setObject(new Integer(1), "V1", "C1");↵ | 2 | s1.↵ | |
3 | o1.setObject(null, "V2", "C1"↵ | 3 | update(0, 0, 1.1);↵ | |
4 | );↵ | 4 | MatrixSeriesCollection c1 = new MatrixSeriesCollection();↵ | |
5 | o1.setObject(new Integer(3), "V3", "C2");↵ | 5 | c1.↵ | |
6 | KeyedObjects2D o↵ | 6 | addSeries(s1);↵ | |
7 | 2 = null;↵ | 7 | MatrixSeriesCollection c2 = null;↵ | |
8 | try {↵ | 8 | try {↵ | |
9 | o2 = (KeyedObjects2D) o1.clone();↵ | 9 | c2 = (MatrixSeriesCollection) c1.clone();↵ | |
10 | }↵ | 10 | }↵ | |
11 | catch (CloneNotSupportedException e) {↵ | 11 | catch (CloneNotSupportedException e) {↵ | |
12 | e.printStackTrace();↵ | 12 | e.printStackTrace();↵ | |
13 | }↵ | 13 | }↵ | |
14 | assertTrue(o1 != o2);↵ | 14 | assertTrue(c1 != c2);↵ | |
15 | assertTrue(o1.getClass() == o2.getClass());↵ | 15 | assertTrue(c1.getClass() == c2.getClass());↵ | |
16 | assertTrue(o1.equals(o2));↵ | 16 | assertTrue(c1.equals(c2));↵ | |
17 | ↵ | |||
18 | // check independence↵ | 17 | // check independence↵ | |
19 | o1.addObject("XX", "R1", "C1");↵ | 18 | s1.setDescription("XYZ");↵ | |
20 | assertFalse(o1.equals(o2)); | 19 | assertFalse(c1.equals(c2)); | |
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 | 104 |
Number of mapped statements | 5 |
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) | 10.7 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
| 1 | MatrixSeries s1 = new MatrixSeries("Series", 2, 3); | ||||||||||||||||||||||
1 | KeyedObjects2D o1 = new KeyedObjects2D(); |
| | ||||||||||||||||||||||
| 2 | s1.update(0, 0, 1.1); | |||||||||||||||||||||||
2 | o1.setObject(new Integer(1), "V1", "C1"); |
| | ||||||||||||||||||||||
|
| 3 | MatrixSeriesCollection c1 = new MatrixSeriesCollection(); | ||||||||||||||||||||||
3 | o1.setObject(null, "V2", "C1"); |
| | ||||||||||||||||||||||
|
| 4 | c1.addSeries(s1); | ||||||||||||||||||||||
4 | o1.setObject(new Integer(3), "V3", "C2"); |
| | ||||||||||||||||||||||
| 5 | MatrixSeriesCollection c2 = null; | |||||||||||||||||||||||
5 | KeyedObjects2D o2 = null; | | |||||||||||||||||||||||
6 | try | 6 | try | ||||||||||||||||||||||
|
| 7 | c2 = (MatrixSeriesCollection)c1.clone(); | ||||||||||||||||||||||
7 | o2 = (KeyedObjects2D)o1.clone(); |
| | ||||||||||||||||||||||
8 | assertTrue(o1 != o2); |
| 8 | assertTrue(c1 != c2); | |||||||||||||||||||||
9 | assertTrue(o1.getClass() == o2.getClass()); |
| 9 | assertTrue(c1.getClass() == c2.getClass()); | |||||||||||||||||||||
10 | assertTrue(o1.equals(o2)); |
| 10 | assertTrue(c1.equals(c2)); | |||||||||||||||||||||
|
| 11 | s1.setDescription("XYZ"); | ||||||||||||||||||||||
11 | o1.addObject("XX", "R1", "C1"); |
| | ||||||||||||||||||||||
12 | assertFalse(o1.equals(o2)); |
| 12 | assertFalse(c1.equals(c2)); |
Row | Violation |
---|---|
1 | Unmatched statement MatrixSeries s1=new MatrixSeries("Series",2,3); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Unmatched statement KeyedObjects2D o1=new KeyedObjects2D(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
3 | Unmatched statement o1.setObject(new Integer(1),"V1","C1"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
4 | Unmatched statement MatrixSeriesCollection c1=new MatrixSeriesCollection(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
5 | Unmatched statement o1.setObject(null,"V2","C1"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
6 | Unmatched statement c1.addSeries(s1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
7 | Unmatched statement o1.setObject(new Integer(3),"V3","C2"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
8 | Unmatched statement c2=(MatrixSeriesCollection)c1.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 |
9 | Unmatched statement o2=(KeyedObjects2D)o1.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 |
10 | Type org.jfree.data.KeyedObjects2D of variable o1 does not match with type org.jfree.data.xy.MatrixSeriesCollection of variable c1 |
11 | Type org.jfree.data.KeyedObjects2D of variable o2 does not match with type org.jfree.data.xy.MatrixSeriesCollection of variable c2 |
12 | Type org.jfree.data.KeyedObjects2D of variable o1 does not match with type org.jfree.data.xy.MatrixSeriesCollection of variable c1 |
13 | Type org.jfree.data.KeyedObjects2D of variable o2 does not match with type org.jfree.data.xy.MatrixSeriesCollection of variable c2 |
14 | Type org.jfree.data.KeyedObjects2D of variable o2 does not match with type org.jfree.data.xy.MatrixSeriesCollection of variable c2 |
15 | Type org.jfree.data.KeyedObjects2D of variable o1 does not match with type org.jfree.data.xy.MatrixSeriesCollection of variable c1 |
16 | Unmatched statement s1.setDescription("XYZ"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
17 | Unmatched statement o1.addObject("XX","R1","C1"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
18 | Type org.jfree.data.KeyedObjects2D of variable o2 does not match with type org.jfree.data.xy.MatrixSeriesCollection of variable c2 |
19 | Type org.jfree.data.KeyedObjects2D of variable o1 does not match with type org.jfree.data.xy.MatrixSeriesCollection of variable c1 |