File path: /jfreechart-1.0.10/tests/org/jfree/chart/block/junit/BlockBorderTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/chart/entity/junit/StandardEntityCollectionTests.java | |||
Method name: void testSerialization()
|
Method name: void testSerialization()
|
|||
Number of AST nodes: 11 | Number of AST nodes: 13 | |||
1 | BlockBorder b1 = new BlockBorder(new RectangleInsets(1.0, 2.0, 3.0, ↵ | 1 | PieSectionEntity e1 = new PieSectionEntity(new Rectangle2D.Double(1.0, ↵ | |
2 | 4.0), new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, ↵ | 2 | 2.0, 3.0, 4.0), new ↵ | |
3 | Color.yellow));↵ | |||
4 | BlockBorder b↵ | 3 | DefaultPieDataset(), 0, 1, "Key", ↵ | |
4 | "ToolTip", "URL");↵ | |||
5 | StandardEntityCollection c1 = new StandardEntityCollection();↵ | |||
6 | c1.add(e1);↵ | |||
5 | 2 = null;↵ | 7 | StandardEntityCollection c2 = null;↵ | |
6 | try {↵ | 8 | try {↵ | |
7 | ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵ | 9 | ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵ | |
8 | ObjectOutput out = new ObjectOutputStream(buffer);↵ | 10 | ObjectOutput out = new ObjectOutputStream(buffer);↵ | |
9 | out.writeObject(b1);↵ | 11 | out.writeObject(c1);↵ | |
10 | out.close();↵ | 12 | out.close();↵ | |
11 | ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(↵ | 13 | ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(↵ | |
12 | buffer.toByteArray()));↵ | 14 | buffer.toByteArray()));↵ | |
13 | b2 = (BlockBorder) in.readObject();↵ | 15 | c2 = (StandardEntityCollection) in.readObject();↵ | |
14 | in.close();↵ | 16 | in.close();↵ | |
15 | }↵ | 17 | }↵ | |
16 | catch (Exception e) {↵ | 18 | catch (Exception e) {↵ | |
17 | fail(e.toString());↵ | 19 | e.printStackTrace();↵ | |
18 | }↵ | 20 | }↵ | |
19 | assertTrue(b1.equals(b2)); | 21 | assertEquals(c1, 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 | 79 |
Number of mapped statements | 8 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 5 |
Time elapsed for statement mapping (ms) | 15.8 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
| 1 | PieSectionEntity e1 = new PieSectionEntity(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), new DefaultPieDataset(), 0, 1, "Key", "ToolTip", "URL"); | ||||||||||||||||||||||||||||
1 | BlockBorder b1 = new BlockBorder(new RectangleInsets(1.0, 2.0, 3.0, 4.0), new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.yellow)); |
| | ||||||||||||||||||||||||||||
|
| 2 | StandardEntityCollection c1 = new StandardEntityCollection(); | ||||||||||||||||||||||||||||
2 | BlockBorder b2 = null; | | |||||||||||||||||||||||||||||
|
| 3 | c1.add(e1); | ||||||||||||||||||||||||||||
| 4 | StandardEntityCollection c2 = null; | |||||||||||||||||||||||||||||
3 | try |
| 5 | try | |||||||||||||||||||||||||||
4 | ByteArrayOutputStream buffer = new ByteArrayOutputStream(); | 6 | ByteArrayOutputStream buffer = new ByteArrayOutputStream(); | ||||||||||||||||||||||||||||
5 | ObjectOutput out = new ObjectOutputStream(buffer); | 7 | ObjectOutput out = new ObjectOutputStream(buffer); | ||||||||||||||||||||||||||||
6 | out.writeObject(b1); |
| 8 | out.writeObject(c1); | |||||||||||||||||||||||||||
7 | out.close(); | 9 | out.close(); | ||||||||||||||||||||||||||||
8 | ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); | 10 | ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); | ||||||||||||||||||||||||||||
9 | b2 = (BlockBorder)in.readObject(); |
| | ||||||||||||||||||||||||||||
|
| 11 | c2 = (StandardEntityCollection)in.readObject(); | ||||||||||||||||||||||||||||
10 | in.close(); | 12 | in.close(); | ||||||||||||||||||||||||||||
11 | assertTrue(b1.equals(b2)); |
| 13 | assertEquals(c1, c2); |
Row | Violation |
---|---|
1 | Unmatched statement PieSectionEntity e1=new PieSectionEntity(new Rectangle2D.Double(1.0,2.0,3.0,4.0),new DefaultPieDataset(),0,1,"Key","ToolTip","URL"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Unmatched statement BlockBorder b1=new BlockBorder(new RectangleInsets(1.0,2.0,3.0,4.0),new GradientPaint(1.0f,2.0f,Color.red,3.0f,4.0f,Color.yellow)); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
3 | Unmatched statement StandardEntityCollection c1=new StandardEntityCollection(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
4 | Unmatched statement c1.add(e1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
5 | Expression fail(e.toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression e.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression fail(e.toString()) is a void method call, and thus it cannot be parameterized |
8 | Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized |
9 | Expression fail(e.toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
10 | Expression e.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
11 | Expression fail(e.toString()) is a void method call, and thus it cannot be parameterized |
12 | Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized |
13 | Type org.jfree.chart.block.BlockBorder of variable b1 does not match with type org.jfree.chart.entity.StandardEntityCollection of variable c1 |
14 | Unmatched statement b2=(BlockBorder)in.readObject(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
15 | Unmatched statement b2=(BlockBorder)in.readObject(); 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 |
16 | Unmatched statement c2=(StandardEntityCollection)in.readObject(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
17 | Unmatched statement c2=(StandardEntityCollection)in.readObject(); 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 |
18 | Expression assertTrue(b1.equals(b2)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
19 | Expression assertEquals(c1,c2) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
20 | Expression assertTrue(b1.equals(b2)) is a void method call, and thus it cannot be parameterized |
21 | Expression assertEquals(c1,c2) is a void method call, and thus it cannot be parameterized |
22 | Expression assertTrue(b1.equals(b2)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
23 | Expression assertEquals(c1,c2) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
24 | Expression assertTrue(b1.equals(b2)) is a void method call, and thus it cannot be parameterized |
25 | Expression assertEquals(c1,c2) is a void method call, and thus it cannot be parameterized |