142-1-34

MultipleXYSeriesLabelGenerator g1 = new MultipleXYSeriesLabelGenerator(); g1.addSeriesLabel(0, "Add0"); g1.addSeriesLabel(0, "Add0b"); g1.addSeriesLabel(1, "Add1"); MultipleXYSeriesLabelGenerator g2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(g1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); g2 = (MultipleXYSeriesLabelGenerator) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(g1, g2);
DefaultOHLCDataset d1 = new DefaultOHLCDataset("Series 1", new OHLCDataItem[0]); DefaultOHLCDataset d2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(d1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray()) ); d2 = (DefaultOHLCDataset) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(d1, d2);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/labels/junit/MultipleXYSeriesLabelGeneratorTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/DefaultOHLCDatasetTests.java
Method name: `void testSerialization()` |  | Method name: `void testSerialization()`
Number of AST nodes: 14 |  | Number of AST nodes: 11

1

    MultipleXYSeriesLabelGenerator g1↵

2

                    = new MultipleXYSeriesLabelGenerator();↵

3

            g1.addSeriesLabel(0, "Add0");↵

4

            g1.addSeriesLabel(0, "Add0b");↵

5

            g1.addSeriesLabel(1, "Add1");↵

6

            MultipleXYSeriesLabelGenerator g↵

1

    DefaultOHLCDataset d1 = new DefaultOHLCDataset("Series 1",↵

2

                    new OHLCDataItem[0]);↵

7

    2 = null;↵

3

            DefaultOHLCDataset d2 = null;↵

8

            try {↵

4

            try {↵

9

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

5

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

10

                ObjectOutput out = new ObjectOutputStream(buffer);↵

6

                ObjectOutput out = new ObjectOutputStream(buffer);↵

11

                out.writeObject(g1);↵

7

                out.writeObject(d1);↵

12

                out.close();↵

8

                out.close();↵

13

                ObjectInput in = new ObjectInputStream(↵

9

                ObjectInput in = new ObjectInputStream(↵

14

                        new ByteArrayInputStream(buffer.toByteArray())↵

10

                    new ByteArrayInputStream(buffer.toByteArray())↵

15

    );↵

11

                );↵

16

                g2 = (MultipleXYSeriesLabelGenerator) in.readObject();↵

12

                d2 = (DefaultOHLCDataset) in.readObject();↵

17

                in.close();↵

13

                in.close();↵

18

            }↵

14

            }↵

19

            catch (Exception e) {↵

15

            catch (Exception e) {↵

20

                e.printStackTrace();↵

16

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

21

            }↵

17

            }↵

22

            assertEquals(g1, g2);

18

            assertEquals(d1, d2);

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