144-7-9

XYDifferenceRenderer r1 = new XYDifferenceRenderer(Color.red, Color.blue, false); XYDifferenceRenderer r2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(r1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); r2 = (XYDifferenceRenderer) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(r1, r2);
XYItemEntity e1 = new XYItemEntity( new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), new TimeSeriesCollection(), 1, 9, "ToolTip", "URL" ); XYItemEntity 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 = (XYItemEntity) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(e1, e2);

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

1

    XYDifferenceRenderer r1 = new XYDifferenceRenderer(Color.red,↵

1

    XY↵

2

                    Color.blue, false↵

2

    ItemEntity e1 = new XYItemEntity(↵

3

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

4

                new TimeSeriesCollection(), 1, 9, "ToolTip", "URL"↵

3

    );↵

5

            ); ↵

4

            XYDifferenceRenderer r2 = null;↵

6

            XYItemEntity e2 = null;↵

5

            try {↵

7

            try {↵

6

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

8

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

7

                ObjectOutput out = new ObjectOutputStream(buffer);↵

9

                ObjectOutput out = new ObjectOutputStream(buffer);↵

8

                out.writeObject(r1);↵

10

                out.writeObject(e1);↵

9

                out.close();↵

11

                out.close();↵

10

                ObjectInput in = new ObjectInputStream(↵

12

                ObjectInput in = new ObjectInputStream(↵

11

                        new ByteArrayInputStream(buffer.toByteArray())↵

13

                    new ByteArrayInputStream(buffer.toByteArray())↵

12

    );↵

14

                );↵

13

                r2 = (XYDifferenceRenderer) in.readObject();↵

15

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

14

                in.close();↵

16

                in.close();↵

15

            }↵

17

            }↵

16

            catch (Exception e) {↵

18

            catch (Exception e) {↵

17

                e.printStackTrace();↵

19

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

18

            }↵

20

            }↵

19

            assertEquals(r1, r2);

21

            assertEquals(e1, e2);

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