229-48-49

ValueMarker m1 = new ValueMarker(25.0); ValueMarker m2 = null; try { m2 = (ValueMarker) m1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(m1 != m2); assertTrue(m1.getClass() == m2.getClass()); assertTrue(m1.equals(m2));
TextTitle t1 = new TextTitle(); TextTitle t2 = null; try { t2 = (TextTitle) t1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(t1 != t2); assertTrue(t1.getClass() == t2.getClass()); assertTrue(t1.equals(t2));

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/ValueMarkerTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/title/junit/TextTitleTests.java
Method name: `void testCloning()` |  | Method name: `void testCloning()`
Number of AST nodes: 7 |  | Number of AST nodes: 7

1

    ValueMarker m1 = new ValueMarker(25.0);↵

2

            ValueMarker m↵

1

    TextTitle t1 = new TextTitle();↵

3

    2 = null;↵

2

            TextTitle t2 = null;↵

4

            try {↵

3

            try {↵

5

                m2 = (ValueMarker) m1.clone();↵

4

                t2 = (TextTitle) t1.clone();↵

6

            }↵

5

            }↵

7

            catch (CloneNotSupportedException e) {↵

6

            catch (CloneNotSupportedException e) {↵

8

                e.printStackTrace();↵

7

                e.printStackTrace();↵

9

            }↵

8

            }↵

10

            assertTrue(m1 != m2);↵

9

            assertTrue(t1 != t2);↵

11

            assertTrue(m1.getClass() == m2.getClass());↵

10

            assertTrue(t1.getClass() == t2.getClass());↵

12

            assertTrue(m1.equals(m2));

11

            assertTrue(t1.equals(t2));

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 1
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 | 21

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 7
   Number of unmapped statements in the first code fragment | 0
   Number of unmapped statements in the second code fragment | 0
   Time elapsed for statement mapping (ms) | 1.3
   Clone type | Type 2

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       ValueMarker m1 = new ValueMarker(25.0);

   1 | ValueMarker m1 = new ValueMarker(25.0);
   1 | TextTitle t1 = new TextTitle();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   m1 | t1 | VARIABLE_NAME_MISMATCH
   new ValueMarker(25.0) | new TextTitle() | ARGUMENT_NUMBER_MISMATCH

   1

       TextTitle t1 = new TextTitle();

   2

       ValueMarker m2 = null;

   2 | ValueMarker m2 = null;
   2 | TextTitle t2 = null;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   m2 | t2 | VARIABLE_NAME_MISMATCH

   2

       TextTitle t2 = null;

   3

       try

   3

       try

   4

       m2 = (ValueMarker)m1.clone();

   4 | m2 = (ValueMarker)m1.clone();
   4 | t2 = (TextTitle)t1.clone();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   m2 | t2 | VARIABLE_NAME_MISMATCH
   m1 | t1 | VARIABLE_NAME_MISMATCH

   4

       t2 = (TextTitle)t1.clone();

   5

       assertTrue(m1 != m2);

   5 | assertTrue(m1 != m2);
   5 | assertTrue(t1 != t2);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   m1 | t1 | VARIABLE_NAME_MISMATCH
   m2 | t2 | VARIABLE_NAME_MISMATCH

   5

       assertTrue(t1 != t2);

   6

       assertTrue(m1.getClass() == m2.getClass());

   6 | assertTrue(m1.getClass() == m2.getClass());
   6 | assertTrue(t1.getClass() == t2.getClass());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   m1 | t1 | VARIABLE_NAME_MISMATCH
   m2 | t2 | VARIABLE_NAME_MISMATCH

   6

       assertTrue(t1.getClass() == t2.getClass());

   7

       assertTrue(m1.equals(m2));

   7 | assertTrue(m1.equals(m2));
   7 | assertTrue(t1.equals(t2));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   m2 | t2 | VARIABLE_NAME_MISMATCH
   m1 | t1 | VARIABLE_NAME_MISMATCH

   7

       assertTrue(t1.equals(t2));

   Precondition Violations (0)
   Row | Violation
   --- | ---