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/dial/junit/StandardDialFrameTests.java | |||
Method name: void testCloning()
|
Method name: void testCloning()
|
|||
Number of AST nodes: 11 | Number of AST nodes: 11 | |||
1 | ArcDialFrame f1 = new ArcDialFrame();↵ | 1 | StandardDialFrame f1 = new StandardDialFrame();↵ | |
2 | ArcDialFrame f2 = null;↵ | 2 | StandardDialFrame f2 = null;↵ | |
3 | try {↵ | 3 | try {↵ | |
4 | f2 = (ArcDialFrame) f1.clone();↵ | 4 | f2 = (StandardDialFrame) f1.clone();↵ | |
5 | }↵ | 5 | }↵ | |
6 | catch (CloneNotSupportedException e) {↵ | 6 | catch (CloneNotSupportedException e) {↵ | |
7 | e.printStackTrace();↵ | 7 | e.printStackTrace();↵ | |
8 | }↵ | 8 | }↵ | |
9 | assertTrue(f1 != f2);↵ | 9 | assertTrue(f1 != f2);↵ | |
10 | assertTrue(f1.getClass() == f2.getClass());↵ | 10 | assertTrue(f1.getClass() == f2.getClass());↵ | |
11 | assertTrue(f1.equals(f2));↵ | 11 | assertTrue(f1.equals(f2));↵ | |
12 | ↵ | 12 | ↵ | |
13 | // check that the listener lists are independent↵ | 13 | // check that the listener lists are independent↵ | |
14 | MyDialLayerChangeListener l1 = new MyDialLayerChangeListener();↵ | 14 | MyDialLayerChangeListener l1 = new MyDialLayerChangeListener();↵ | |
15 | f1.addChangeListener(l1);↵ | 15 | f1.addChangeListener(l1);↵ | |
16 | assertTrue(f1.hasListener(l1));↵ | 16 | assertTrue(f1.hasListener(l1));↵ | |
17 | assertFalse(f2.hasListener(l1)); | 17 |
| |
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 | 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) | 35.9 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | ArcDialFrame f1 = new ArcDialFrame(); |
| 1 | StandardDialFrame f1 = new StandardDialFrame(); | ||||||||||||||||||
2 | ArcDialFrame f2 = null; |
| 2 | StandardDialFrame f2 = null; | ||||||||||||||||||
3 | try | 3 | try | |||||||||||||||||||
4 | f2 = (ArcDialFrame)f1.clone(); |
| 4 | f2 = (StandardDialFrame)f1.clone(); | ||||||||||||||||||
5 | assertTrue(f1 != f2); |
| 5 | assertTrue(f1 != f2); | ||||||||||||||||||
6 | assertTrue(f1.getClass() == f2.getClass()); |
| 6 | assertTrue(f1.getClass() == f2.getClass()); | ||||||||||||||||||
7 | assertTrue(f1.equals(f2)); |
| 7 | assertTrue(f1.equals(f2)); | ||||||||||||||||||
8 | MyDialLayerChangeListener l1 = new MyDialLayerChangeListener(); | 8 | MyDialLayerChangeListener l1 = new MyDialLayerChangeListener(); | |||||||||||||||||||
9 | f1.addChangeListener(l1); |
| 9 | f1.addChangeListener(l1); | ||||||||||||||||||
10 | assertTrue(f1.hasListener(l1)); |
| 10 | assertTrue(f1.hasListener(l1)); | ||||||||||||||||||
11 | assertFalse(f2.hasListener(l1)); |
| 11 | assertFalse(f2.hasListener(l1)); |
Row | Violation |
---|---|
1 | Expression new ArcDialFrame() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression new StandardDialFrame() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression (ArcDialFrame)f1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression (StandardDialFrame)f1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted |