142-14-44

OHLCDataItem i1 = new OHLCDataItem( new Date(1L), 1.0, 2.0, 3.0, 4.0, 5.0 ); OHLCDataItem 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 = (OHLCDataItem) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(i1, i2);
DateTickMarkPosition p1 = DateTickMarkPosition.MIDDLE; DateTickMarkPosition 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 = (DateTickMarkPosition) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(p1, p2); assertTrue(p1 == p2);

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

1

    OHLCDataItem i1 = new OHLCDataItem(↵

2

                new Date(1L), 1.0, 2.0, 3.0, 4.0, 5.0↵

3

            );↵

4

            OHLCDataItem i↵

1

    DateTickMarkPosition p1 = DateTickMarkPosition.MIDDLE;↵

5

    2 = null;↵

2

            DateTickMarkPosition p2 = null;↵

6

            ↵

7

            try {↵

3

            try {↵

8

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

4

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

9

                ObjectOutput out = new ObjectOutputStream(buffer);↵

5

                ObjectOutput out = new ObjectOutputStream(buffer);↵

10

                out.writeObject(i1);↵

6

                out.writeObject(p1);↵

11

                out.close();↵

7

                out.close();↵

12

                ObjectInput in = new ObjectInputStream(↵

8

                ObjectInput in = new ObjectInputStream(↵

13

                    new ByteArrayInputStream(buffer.toByteArray())↵

9

                    new ByteArrayInputStream(buffer.toByteArray())↵

14

                );↵

10

                );↵

15

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

11

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

16

                in.close();↵

12

                in.close();↵

17

            }↵

13

            }↵

18

            catch (Exception e) {↵

14

            catch (Exception e) {↵

19

                e.printStackTrace();↵

15

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

20

            }↵

16

            }↵

21

            assertEquals(i1, i↵

17

            assertEquals(p1, p2);↵

22

    2);

18

            assertTrue(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