115-2-21

DefaultKeyedValues2D kv2D1 = new DefaultKeyedValues2D(); kv2D1.addValue(new Double(234.2), "Row1", "Col1"); kv2D1.addValue(null, "Row1", "Col2"); kv2D1.addValue(new Double(345.9), "Row2", "Col1"); kv2D1.addValue(new Double(452.7), "Row2", "Col2"); DefaultKeyedValues2D kv2D2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(kv2D1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); kv2D2 = (DefaultKeyedValues2D) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(kv2D1, kv2D2);
BoxAndWhiskerItem i1 = new BoxAndWhiskerItem( new Double(1.0), new Double(2.0), new Double(3.0), new Double(4.0), new Double(5.0), new Double(6.0), new Double(7.0), new Double(8.0), new ArrayList() ); BoxAndWhiskerItem 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 = (BoxAndWhiskerItem) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(i1, i2);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/data/junit/DefaultKeyedValues2DTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/data/statistics/junit/BoxAndWhiskerItemTests.java
Method name: `void testSerialization()` |  | Method name: `void testSerialization()`
Number of AST nodes: 15 |  | Number of AST nodes: 11

1

    DefaultKeyedValues2D kv2D1 = new DefaultKeyedValues2D();↵

2

            kv2D1.addValue(new Double(234.2), "Row1", "Col1");↵

3

            kv2D1.addValue(null, "Row1", "Col2");↵

4

            kv2D1.addValue(↵

1

    BoxAndWhiskerItem i1 = new BoxAndWhiskerItem(↵

2

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

5

    new Double(345.9), "Row2", "Col1");↵

3

                new Double(5.0), ↵

6

            kv2D1.addValue(new Double(452.7), "Row2", "Col2");↵

7

            DefaultKeyedValues2D kv2D↵

4

    new Double(6.0), new Double(7.0), new Double(8.0), ↵

5

                new ArrayList()↵

6

            );↵

8

    2 = null;↵

7

            BoxAndWhiskerItem i2 = null;↵

8

            ↵

9

            try {↵

9

            try {↵

10

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

10

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

11

                ObjectOutput out = new ObjectOutputStream(buffer);↵

11

                ObjectOutput out = new ObjectOutputStream(buffer);↵

12

                out.writeObject(kv2D1);↵

12

                out.writeObject(i1);↵

13

                out.close();↵

13

                out.close();↵

14

                ObjectInput in = new ObjectInputStream(↵

14

                ObjectInput in = new ObjectInputStream(↵

15

                        new ByteArrayInputStream(buffer.toByteArray())↵

15

                    new ByteArrayInputStream(buffer.toByteArray())↵

16

    );↵

16

                );↵

17

                kv2D2 = (DefaultKeyedValues2D) in.readObject();↵

17

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

18

                in.close();↵

18

                in.close();↵

19

            }↵

19

            }↵

20

            catch (Exception e) {↵

20

            catch (Exception e) {↵

21

                e.printStackTrace();↵

21

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

22

            }↵

22

            }↵

23

            assertEquals(kv2D1, kv2D2);

23

            assertEquals(i1, i2);

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