File path: /jfreechart-1.0.10/tests/org/jfree/chart/entity/junit/ContourEntityTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/xy/junit/XYErrorRendererTests.java | |||
Method name: void testSerialization()
|
Method name: void testSerialization()
|
|||
Number of AST nodes: 11 | Number of AST nodes: 12 | |||
1 | ContourEntity e1 = new ContourEntity(↵ | |||
2 | new Rectangle2D.Double↵ | 1 | XYErrorRenderer r1 = new XYErrorRenderer();↵ | |
3 | (1.0, 2.0, 3.0, 4.0), "ToolTip", "URL"↵ | 2 | r1.setErrorPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0↵ | |
4 | ↵ | 3 | f,↵ | |
5 | ); ↵ | 4 | Color.white));↵ | |
6 | ContourEntity e2 = null;↵ | 5 | XYErrorRenderer r2 = null;↵ | |
7 | try {↵ | 6 | try {↵ | |
8 | ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵ | 7 | ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵ | |
9 | ObjectOutput out = new ObjectOutputStream(buffer);↵ | 8 | ObjectOutput out = new ObjectOutputStream(buffer);↵ | |
10 | out.writeObject(e1);↵ | 9 | out.writeObject(r1);↵ | |
11 | out.close();↵ | 10 | out.close();↵ | |
12 | ObjectInput in = new ObjectInputStream(↵ | 11 | ObjectInput in = new ObjectInputStream(↵ | |
13 | new ByteArrayInputStream(buffer.toByteArray())↵ | 12 | new ByteArrayInputStream(buffer.toByteArray())↵ | |
14 | );↵ | 13 | );↵ | |
15 | e2 = (ContourEntity) in.readObject();↵ | 14 | r2 = (XYErrorRenderer) in.readObject();↵ | |
16 | in.close();↵ | 15 | in.close();↵ | |
17 | }↵ | 16 | }↵ | |
18 | catch (Exception e) {↵ | 17 | catch (Exception e) {↵ | |
19 | System.out.println(e.toString());↵ | 18 | e.printStackTrace();↵ | |
20 | }↵ | 19 | }↵ | |
21 | assertEquals(e1, e2); | 20 | assertEquals(r1, r2); | |
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.3 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 72 |
Number of mapped statements | 11 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 54.9 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | ContourEntity e1 = new ContourEntity(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), "ToolTip", "URL"); |
| 1 | XYErrorRenderer r1 = new XYErrorRenderer(); | |||||||||||||||||||||||||
|
| 2 | r1.setErrorPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.white)); | ||||||||||||||||||||||||||
2 | ContourEntity e2 = null; |
| 3 | XYErrorRenderer r2 = null; | |||||||||||||||||||||||||
3 | try |
| 4 | try | |||||||||||||||||||||||||
4 | ByteArrayOutputStream buffer = new ByteArrayOutputStream(); | 5 | ByteArrayOutputStream buffer = new ByteArrayOutputStream(); | ||||||||||||||||||||||||||
5 | ObjectOutput out = new ObjectOutputStream(buffer); | 6 | ObjectOutput out = new ObjectOutputStream(buffer); | ||||||||||||||||||||||||||
6 | out.writeObject(e1); |
| 7 | out.writeObject(r1); | |||||||||||||||||||||||||
7 | out.close(); | 8 | out.close(); | ||||||||||||||||||||||||||
8 | ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); | 9 | ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); | ||||||||||||||||||||||||||
9 | e2 = (ContourEntity)in.readObject(); |
| 10 | r2 = (XYErrorRenderer)in.readObject(); | |||||||||||||||||||||||||
10 | in.close(); | 11 | in.close(); | ||||||||||||||||||||||||||
11 | assertEquals(e1, e2); |
| 12 | assertEquals(r1, r2); |
Row | Violation |
---|---|
1 | Expression new XYErrorRenderer() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression new XYErrorRenderer() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement r1.setErrorPaint(new GradientPaint(1.0f,2.0f,Color.red,3.0f,4.0f,Color.white)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Expression System.out.println(e.toString()) cannot be parameterized, because it has dependencies to/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 System.out.println(e.toString()) is a void method call, and thus it cannot be parameterized |
7 | Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized |
8 | Expression e cannot be parameterized, because it has dependencies to/from statements that will be extracted |
9 | Expression System.out.println(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 System.out.println(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 | Expression e1 cannot be unified with expression r1 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public abstract void writeObject(java.lang.Object) throws java.io.IOException |
14 | Expression (ContourEntity)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
15 | Expression (XYErrorRenderer)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
16 | Expression e1 cannot be unified with expression r1 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public static void assertEquals(java.lang.Object, java.lang.Object) |
17 | Expression e2 cannot be unified with expression r2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public static void assertEquals(java.lang.Object, java.lang.Object) |