144-3-9

ChartRenderingInfo i1 = new ChartRenderingInfo(); i1.setChartArea(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0)); ChartRenderingInfo i2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(i1); out.close(); ObjectInput in = new ObjectInputStream(new ByteArrayInputStream( buffer.toByteArray())); i2 = (ChartRenderingInfo) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(i1, i2);
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/junit/ChartRenderingInfoTests.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: 12 |  | Number of AST nodes: 11

1

    ChartRenderingInfo i1 = new ChartRenderingInfo();↵

2

            i1.setChartArea(↵

1

    XYItemEntity e1 = new XYItemEntity(↵

3

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

2

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

4

            ChartRenderingInfo i↵

3

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

4

            ); ↵

5

    2 = null;↵

5

            XYItemEntity e2 = 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(i1);↵

9

                out.writeObject(e1);↵

10

                out.close();↵

10

                out.close();↵

11

                ObjectInput in = new ObjectInputStream(↵

11

                ObjectInput in = new ObjectInputStream(↵

12

    new ByteArrayInputStream(↵

12

                    new ByteArrayInputStream(↵

13

                        buffer.toByteArray())↵

13

    buffer.toByteArray())↵

14

    );↵

14

                );↵

15

                i2 = (ChartRenderingInfo) in.readObject();↵

15

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

16

                in.close();↵

16

                in.close();↵

17

            }↵

17

            }↵

18

            catch (Exception e) {↵

18

            catch (Exception e) {↵

19

                e.printStackTrace();↵

19

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

20

            }↵

20

            }↵

21

            assertEquals(i1, i2);

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