391-3-7

ContourEntity e1 = new ContourEntity( new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), "ToolTip", "URL" ); ContourEntity 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 = (ContourEntity) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(e1, e2);
MultiplePiePlot p1 = new MultiplePiePlot(null); p1.setAggregatedItemsPaint(new GradientPaint(1.0f, 2.0f, Color.yellow, 3.0f, 4.0f, Color.red)); MultiplePiePlot p2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(p1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray()) ); p2 = (MultiplePiePlot) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(p1, p2);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/entity/junit/ContourEntityTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/MultiplePiePlotTests.java
Method name: `void testSerialization()` |  | Method name: `void testSerialization()`
Number of AST nodes: 11 |  | Number of AST nodes: 12

1

    ContourEntity e1 = new ContourEntity(↵

2

                new Rectangle2D.Double↵

1

    MultiplePiePlot p1 = new MultiplePiePlot(null);↵

3

    (1.0, 2.0, 3.0, 4.0), "ToolTip", "URL"↵

2

            p1.setAggregatedItemsPaint(new GradientPaint(1.0f, 2.0↵

3

    f, Color.yellow,↵

4

            ); ↵

4

             ↵

5

            ContourEntity e↵

5

           3.0f, 4.0f, Color.red));↵

6

    2 = null;↵

6

            MultiplePiePlot p2 = null;↵

7

            try {↵

7

            try {↵

8

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

8

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

9

                ObjectOutput out = new ObjectOutputStream(buffer);↵

9

                ObjectOutput out = new ObjectOutputStream(buffer);↵

10

                out.writeObject(e1);↵

10

                out.writeObject(p1);↵

11

                out.close();↵

11

                out.close();↵

12

                ObjectInput in = new ObjectInputStream(↵

12

                ObjectInput in = new ObjectInputStream(↵

13

                    new ByteArrayInputStream(buffer.toByteArray())↵

13

                    new ByteArrayInputStream(buffer.toByteArray())↵

14

                );↵

14

                );↵

15

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

15

                p2 = (MultiplePiePlot) in.readObject();↵

16

                in.close();↵

16

                in.close();↵

17

            }↵

17

            }↵

18

            catch (Exception e) {↵

18

            catch (Exception e) {↵

19

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

19

                e.printStackTrace();↵

20

            }↵

20

            }↵

21

            assertEquals(e1, e2);

21

            assertEquals(p1, p2);

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