115-13-25

CategoryLabelEntity e1 = new CategoryLabelEntity("A", new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), "ToolTip", "URL"); CategoryLabelEntity e2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(e1); out.close(); ObjectInput in = new ObjectInputStream(new ByteArrayInputStream( buffer.toByteArray())); e2 = (CategoryLabelEntity) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(e1, e2);
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/chart/entity/junit/CategoryLabelEntityTests.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: 11 |  | Number of AST nodes: 12

1

    CategoryLabelEntity e1 = new CategoryLabelEntity("A", ↵

2

                    new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), "ToolTip", "URL"↵

1

    PeriodAxisLabelInfo info1 = new PeriodAxisLabelInfo(↵

2

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

3

    ); ↵

3

            );↵

4

            CategoryLabelEntity e2 = 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(e1);↵

8

                out.writeObject(info1);↵

9

                out.close();↵

9

                out.close();↵

10

                ObjectInput in = new ObjectInputStream(↵

10

                ObjectInput in = new ObjectInputStream(↵

11

    new ByteArrayInputStream(↵

11

                    new ByteArrayInputStream(↵

12

                        buffer.toByteArray())↵

12

    buffer.toByteArray())↵

13

    );↵

13

                );↵

14

                e2 = (CategoryLabelEntity) in.readObject();↵

14

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

15

                in.close();↵

15

                in.close();↵

16

            }↵

16

            }↵

17

            catch (Exception e) {↵

17

            catch (Exception e) {↵

18

                e.printStackTrace();↵

18

                ↵

19

            }↵

20

            assertEquals(e1, e2↵

19

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

20

            }↵

21

            boolean b = info1.equals(info2);↵

21

    );

22

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