391-1-12

DateTick t1 = new DateTick( new Date(0L), "Label", TextAnchor.CENTER, TextAnchor.CENTER, 10.0 ); DateTick t2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(t1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray()) ); t2 = (DateTick) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(t1, t2);
VectorSeries s1 = new VectorSeries("Series"); s1.add(1.0, 1.1, 1.2, 1.3); VectorSeriesCollection c1 = new VectorSeriesCollection(); c1.addSeries(s1); VectorSeriesCollection c2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(c1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); c2 = (VectorSeriesCollection) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(c1, c2);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/DateTickTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/VectorSeriesCollectionTests.java
Method name: `void testSerialization()` |  | Method name: `void testSerialization()`
Number of AST nodes: 11 |  | Number of AST nodes: 14

1

    DateTick t1 = new DateTick(↵

2

                new Date(0L), "Label", TextAnchor.CENTER, TextAnchor.CENTER, 10.0↵

3

            );↵

4

            DateTick t↵

1

    VectorSeries s1 = new VectorSeries("Series");↵

2

            s1.add(1.0, 1.1, 1.2, 1.3);↵

3

            VectorSeriesCollection c1 = new VectorSeriesCollection();↵

4

            c1.addSeries(s1);↵

5

    2 = null;↵

5

            VectorSeriesCollection c2 = null;↵

6

            try {↵

6

            try {↵

7

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

7

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

8

                ObjectOutput out = new ObjectOutputStream(buffer);↵

8

                ObjectOutput out = new ObjectOutputStream(buffer);↵

9

                out.writeObject(t1);↵

9

                out.writeObject(c1);↵

10

                out.close();↵

10

                out.close();↵

11

                ObjectInput in = new ObjectInputStream(↵

11

                ObjectInput in = new ObjectInputStream(↵

12

                    new ByteArrayInputStream(buffer.toByteArray())↵

12

                        new ByteArrayInputStream(buffer.toByteArray())↵

13

                );↵

13

    );↵

14

                t2 = (DateTick) in.readObject();↵

14

                c2 = (VectorSeriesCollection) in.readObject();↵

15

                in.close();↵

15

                in.close();↵

16

            }↵

16

            }↵

17

            catch (Exception e) {↵

17

            catch (Exception e) {↵

18

                System.out.println(e.toString());↵

18

                e.printStackTrace();↵

19

            }↵

19

            }↵

20

            assertEquals(t1, t2);

20

            assertEquals(c1, c2);

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 0
Number of refactorable cases | 0
Number of non-refactorable cases | 0
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 | 1