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