115-9-25

MyComparableObjectSeries s1 = new MyComparableObjectSeries("A"); s1.add(new Integer(1), "ABC"); MyComparableObjectSeries s2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(s1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); s2 = (MyComparableObjectSeries) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(s1, s2);
PeriodAxisLabelInfo info1 = new PeriodAxisLabelInfo( Day.class, new SimpleDateFormat("d") ); PeriodAxisLabelInfo info2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(info1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray()) ); info2 = (PeriodAxisLabelInfo) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } boolean b = info1.equals(info2); assertTrue(b);

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

1

    MyComparableObjectSeries s1 = new MyComparableObjectSeries("A");↵

2

            s1.add(new Integer(1), "ABC");↵

3

            MyComparableObjectSeries s↵

1

    PeriodAxisLabelInfo info1 = new PeriodAxisLabelInfo(↵

2

                Day.class, new SimpleDateFormat("d")↵

3

            );↵

4

    2 = null;↵

4

            PeriodAxisLabelInfo info2 = null;↵

5

            try {↵

5

            try {↵

6

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

6

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

7

                ObjectOutput out = new ObjectOutputStream(buffer);↵

7

                ObjectOutput out = new ObjectOutputStream(buffer);↵

8

                out.writeObject(s1);↵

8

                out.writeObject(info1);↵

9

                out.close();↵

9

                out.close();↵

10

                ObjectInput in = new ObjectInputStream(↵

10

                ObjectInput in = new ObjectInputStream(↵

11

                        new ByteArrayInputStream(buffer.toByteArray())↵

11

                    new ByteArrayInputStream(buffer.toByteArray())↵

12

    );↵

12

                );↵

13

                s2 = (MyComparableObjectSeries) in.readObject();↵

13

                info2 = (PeriodAxisLabelInfo) in.readObject();↵

14

                in.close();↵

14

                in.close();↵

15

            }↵

15

            }↵

16

            catch (Exception e) {↵

16

            catch (Exception e) {↵

17

                e.printStackTrace();↵

17

                ↵

18

            }↵

19

            assertEquals(s1, s2↵

18

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

19

            }↵

20

            boolean b = info1.equals(info2);↵

20

    );

21

            assertTrue(b);

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.2
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 1