File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/DefaultIntervalXYDatasetTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/DefaultWindDatasetTests.java | |||
Method name: void testSerialization()
|
Method name: void testSerialization()
|
|||
Number of AST nodes: 21 | Number of AST nodes: 21 | |||
1 | DefaultIntervalXYDataset d1 = new DefaultIntervalXYDataset();↵ | 1 | DefaultWindDataset d1 = new DefaultWindDataset();↵ | |
2 | DefaultIntervalXYDataset d2 = null;↵ | 2 | DefaultWindDataset d2 = null;↵ | |
3 | try {↵ | 3 | try {↵ | |
4 | ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵ | 4 | ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵ | |
5 | ObjectOutput out = new ObjectOutputStream(buffer);↵ | 5 | ObjectOutput out = new ObjectOutputStream(buffer);↵ | |
6 | out.writeObject(d1);↵ | 6 | out.writeObject(d1);↵ | |
7 | out.close();↵ | 7 | out.close();↵ | |
8 | ObjectInput in = new ObjectInputStream(↵ | 8 | ObjectInput in = new ObjectInputStream(↵ | |
9 | new ByteArrayInputStream(↵ | 9 | new ByteArrayInputStream(↵ | |
10 | buffer.toByteArray()));↵ | 10 | buffer.toByteArray()));↵ | |
11 | d2 = (DefaultIntervalXYDataset) in.readObject();↵ | 11 | d2 = (DefaultWindDataset) in.readObject();↵ | |
12 | in.close();↵ | 12 | in.close();↵ | |
13 | }↵ | 13 | }↵ | |
14 | catch (Exception e) {↵ | 14 | catch (Exception e) {↵ | |
15 | e.printStackTrace();↵ | 15 | e.printStackTrace();↵ | |
16 | }↵ | 16 | }↵ | |
17 | assertEquals(d1, d2);↵ | 17 | assertEquals(d1, d2);↵ | |
18 | // try a dataset with some content...↵ | 18 | // try a dataset with some content...↵ | |
19 | d1 = createSampleDataset1();↵ | 19 | d1 = createSampleDataset1();↵ | |
20 | try {↵ | 20 | try {↵ | |
21 | ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵ | 21 | ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵ | |
22 | ObjectOutput out = new ObjectOutputStream(buffer);↵ | 22 | ObjectOutput out = new ObjectOutputStream(buffer);↵ | |
23 | out.writeObject(d1);↵ | 23 | out.writeObject(d1);↵ | |
24 | out.close();↵ | 24 | out.close();↵ | |
25 | ObjectInput in = new ObjectInputStream(↵ | 25 | ObjectInput in = new ObjectInputStream(↵ | |
26 | new ByteArrayInputStream(↵ | 26 | new ByteArrayInputStream(↵ | |
27 | buffer.toByteArray()));↵ | 27 | buffer.toByteArray()));↵ | |
28 | d2 = (DefaultIntervalXYDataset) in.readObject();↵ | 28 | d2 = (DefaultWindDataset) in.readObject();↵ | |
29 | in.close();↵ | 29 | in.close();↵ | |
30 | }↵ | 30 | }↵ | |
31 | catch (Exception e) {↵ | 31 | catch (Exception e) {↵ | |
32 | e.printStackTrace();↵ | 32 | e.printStackTrace();↵ | |
33 | }↵ | 33 | }↵ | |
34 | assertEquals(d1, d2); | 34 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.4 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 202 |
Number of mapped statements | 21 |
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) | 72.3 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | DefaultIntervalXYDataset d1 = new DefaultIntervalXYDataset(); |
| 1 | DefaultWindDataset d1 = new DefaultWindDataset(); | ||||||||||||||||||
2 | DefaultIntervalXYDataset d2 = null; |
| 2 | DefaultWindDataset d2 = null; | ||||||||||||||||||
3 | try | 3 | try | |||||||||||||||||||
4 | ByteArrayOutputStream buffer = new ByteArrayOutputStream(); | 4 | ByteArrayOutputStream buffer = new ByteArrayOutputStream(); | |||||||||||||||||||
5 | ObjectOutput out = new ObjectOutputStream(buffer); | 5 | ObjectOutput out = new ObjectOutputStream(buffer); | |||||||||||||||||||
6 | out.writeObject(d1); |
| 6 | out.writeObject(d1); | ||||||||||||||||||
7 | out.close(); | 7 | out.close(); | |||||||||||||||||||
8 | ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); | 8 | ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); | |||||||||||||||||||
9 | d2 = (DefaultIntervalXYDataset)in.readObject(); |
| 9 | d2 = (DefaultWindDataset)in.readObject(); | ||||||||||||||||||
10 | in.close(); | 10 | in.close(); | |||||||||||||||||||
11 | assertEquals(d1, d2); |
| 11 | assertEquals(d1, d2); | ||||||||||||||||||
12 | d1 = createSampleDataset1(); |
| 12 | d1 = createSampleDataset1(); | ||||||||||||||||||
13 | try | 13 | try | |||||||||||||||||||
14 | ByteArrayOutputStream buffer = new ByteArrayOutputStream(); | 14 | ByteArrayOutputStream buffer = new ByteArrayOutputStream(); | |||||||||||||||||||
15 | ObjectOutput out = new ObjectOutputStream(buffer); | 15 | ObjectOutput out = new ObjectOutputStream(buffer); | |||||||||||||||||||
16 | out.writeObject(d1); |
| 16 | out.writeObject(d1); | ||||||||||||||||||
17 | out.close(); | 17 | out.close(); | |||||||||||||||||||
18 | ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); | 18 | ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); | |||||||||||||||||||
19 | d2 = (DefaultIntervalXYDataset)in.readObject(); |
| 19 | d2 = (DefaultWindDataset)in.readObject(); | ||||||||||||||||||
20 | in.close(); | 20 | in.close(); | |||||||||||||||||||
21 | assertEquals(d1, d2); |
| 21 | assertEquals(d1, d2); |
Row | Violation |
---|---|
1 | Expression new DefaultIntervalXYDataset() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression new DefaultWindDataset() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression (DefaultIntervalXYDataset)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression (DefaultWindDataset)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression (DefaultIntervalXYDataset)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression (DefaultWindDataset)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted |