File path: /jfreechart-1.0.10/tests/org/jfree/chart/annotations/junit/XYLineAnnotationTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/MatrixSeriesCollectionTests.java | |||
Method name: void testSerialization()
|
Method name: void testSerialization()
|
|||
Number of AST nodes: 12 | Number of AST nodes: 14 | |||
1 | Stroke stroke = new BasicStroke(2.0f);↵ | |||
2 | XYLineAnnota↵ | 1 | MatrixSeries s1 = new MatrixSeries("Series", 2, 3);↵ | |
2 | s1.update(0, 0, 1.1);↵ | |||
3 | tion a1 = new XYLineAnnotation(↵ | 3 | MatrixSeriesCollection c1 = new MatrixSeriesCollection(↵ | |
4 | ↵ | 4 | );↵ | |
5 | 10.0, 20.0, 100.0, 200.0, stroke, Color.blue↵ | 5 | ↵ | |
6 | );↵ | |||
7 | XYLineAnnota↵ | 6 | c1.addSeries(s1);↵ | |
8 | tion a2 = null;↵ | 7 | MatrixSeriesCollection c2 = null;↵ | |
9 | try {↵ | 8 | try {↵ | |
10 | ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵ | 9 | ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵ | |
11 | ObjectOutput out = new ObjectOutputStream(buffer);↵ | 10 | ObjectOutput out = new ObjectOutputStream(buffer);↵ | |
12 | out.writeObject(a1);↵ | 11 | out.writeObject(c1);↵ | |
13 | out.close();↵ | 12 | out.close();↵ | |
14 | ObjectInput in = new ObjectInputStream(↵ | 13 | ObjectInput in = new ObjectInputStream(↵ | |
15 | new ByteArrayInputStream(buffer.toByteArray())↵ | 14 | new ByteArrayInputStream(buffer.toByteArray())↵ | |
16 | );↵ | 15 | );↵ | |
17 | a2 = (XYLineAnnotation) in.readObject();↵ | 16 | c2 = (MatrixSeriesCollection) in.readObject();↵ | |
18 | in.close();↵ | 17 | in.close();↵ | |
19 | }↵ | 18 | }↵ | |
20 | catch (Exception e) {↵ | 19 | catch (Exception e) {↵ | |
21 | System.out.println(e.toString());↵ | 20 | e.printStackTrace();↵ | |
22 | }↵ | 21 | }↵ | |
23 | assertEquals(a1, a2); | 22 | 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.3 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 82 |
Number of mapped statements | 11 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 37.8 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
| 1 | MatrixSeries s1 = new MatrixSeries("Series", 2, 3); | |||||||||||||||||||||||||||
1 | Stroke stroke = new BasicStroke(2.0f); | | ||||||||||||||||||||||||||||
| 2 | s1.update(0, 0, 1.1); | ||||||||||||||||||||||||||||
2 | XYLineAnnotation a1 = new XYLineAnnotation(10.0, 20.0, 100.0, 200.0, stroke, Color.blue); |
| 3 | MatrixSeriesCollection c1 = new MatrixSeriesCollection(); | ||||||||||||||||||||||||||
|
| 4 | c1.addSeries(s1); | |||||||||||||||||||||||||||
3 | XYLineAnnotation a2 = null; |
| 5 | MatrixSeriesCollection c2 = null; | ||||||||||||||||||||||||||
4 | try |
| 6 | try | ||||||||||||||||||||||||||
5 | ByteArrayOutputStream buffer = new ByteArrayOutputStream(); | 7 | ByteArrayOutputStream buffer = new ByteArrayOutputStream(); | |||||||||||||||||||||||||||
6 | ObjectOutput out = new ObjectOutputStream(buffer); | 8 | ObjectOutput out = new ObjectOutputStream(buffer); | |||||||||||||||||||||||||||
7 | out.writeObject(a1); |
| 9 | out.writeObject(c1); | ||||||||||||||||||||||||||
8 | out.close(); | 10 | out.close(); | |||||||||||||||||||||||||||
9 | ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); | 11 | ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); | |||||||||||||||||||||||||||
10 | a2 = (XYLineAnnotation)in.readObject(); |
| 12 | c2 = (MatrixSeriesCollection)in.readObject(); | ||||||||||||||||||||||||||
11 | in.close(); | 13 | in.close(); | |||||||||||||||||||||||||||
12 | assertEquals(a1, a2); |
| 14 | assertEquals(c1, 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 | Expression new XYLineAnnotation(10.0,20.0,100.0,200.0,stroke,Color.blue) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression new MatrixSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression new XYLineAnnotation(10.0,20.0,100.0,200.0,stroke,Color.blue) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression new MatrixSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Unmatched statement c1.addSeries(s1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
7 | Expression System.out.println(e.toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression e.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
9 | Expression System.out.println(e.toString()) is a void method call, and thus it cannot be parameterized |
10 | Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized |
11 | Expression e cannot be parameterized, because it has dependencies to/from statements that will be extracted |
12 | Expression System.out.println(e.toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
13 | Expression e.printStackTrace() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
14 | Expression System.out.println(e.toString()) is a void method call, and thus it cannot be parameterized |
15 | Expression e.printStackTrace() is a void method call, and thus it cannot be parameterized |
16 | Expression a1 cannot be unified with expression c1 , 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 |
17 | Expression (XYLineAnnotation)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
18 | Expression (MatrixSeriesCollection)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
19 | Expression a1 cannot be unified with expression c1 , 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) |
20 | Expression a2 cannot be unified with expression c2 , 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) |
21 | Clone fragment #1 returns variables , while Clone fragment #2 returns variables c1 |