1007-3-8

CandlestickRenderer r1 = new CandlestickRenderer(); // check defaults assertEquals(Color.green, r1.getUpPaint()); assertEquals(Color.red, r1.getDownPaint()); assertFalse(r1.getUseOutlinePaint()); assertTrue(r1.getDrawVolume()); assertEquals(Color.gray, r1.getVolumePaint()); assertEquals(-1.0, r1.getCandleWidth(), EPSILON);
DefaultTableXYDataset d1 = new DefaultTableXYDataset(); DefaultTableXYDataset d2 = new DefaultTableXYDataset(); assertTrue(d1.equals(d2)); assertTrue(d2.equals(d1)); d1.addSeries(createSeries1()); assertFalse(d1.equals(d2)); d2.addSeries(createSeries1()); assertTrue(d1.equals(d2));

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/xy/junit/CandlestickRendererTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/TableXYDatasetTests.java
Method name: `void testConstructor()` |  | Method name: `void testEquals()`
Number of AST nodes: 7 |  | Number of AST nodes: 8

1

    CandlestickRenderer r1 = new CandlestickRenderer();↵

1

    DefaultTableXYDataset d1 = new DefaultTableXYDataset();↵

2

            // check defaults↵

2

            ↵

3

            assertEquals(Color.green, r1.getUpPaint());↵

4

            assertEquals(Color.red, r1.getDownPaint(↵

3

    DefaultTableXYDataset d2 = new DefaultTableXYDataset();↵

4

            assertTrue(d1.equals(d2));↵

5

    ));↵

5

            assertTrue(d2.equals(d1));↵

6

            assertFalse(r1.getUseOutlinePaint());↵

6

            d1.addSeries(createSeries1());↵

7

            assertTrue(r1.getDrawVolume());↵

7

            assertFalse(d1.equals(d2));↵

8

            assertEquals(Color.gray, r1.getVolumePaint());↵

8

            ↵

9

            assertEquals(-1.0, r1.getCandleWidth(), EPSILON↵

9

    d2.addSeries(createSeries1());↵

10

    );

10

            assertTrue(d1.equals(d2));

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.0
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 56

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 4
   Number of unmapped statements in the first code fragment | 3
   Number of unmapped statements in the second code fragment | 4
   Time elapsed for statement mapping (ms) | 0.0
   Clone type | Type 3

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

   1

       DefaultTableXYDataset d1 = new DefaultTableXYDataset();

   1

       CandlestickRenderer r1 = new CandlestickRenderer();

   2

       DefaultTableXYDataset d2 = new DefaultTableXYDataset();

   2

       assertEquals(Color.green, r1.getUpPaint());

   2 | assertEquals(Color.green, r1.getUpPaint());
   4 | assertTrue(d2.equals(d1));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   assertEquals | assertTrue | METHOD_INVOCATION_NAME_MISMATCH
   assertEquals(Color.green,r1.getUpPaint()) | assertTrue(d2.equals(d1)) | ARGUMENT_NUMBER_MISMATCH

   Preondition Violations
   Expression assertEquals(Color.green,r1.getUpPaint()) is a void method call, and thus it cannot be parameterized
   Expression assertTrue(d2.equals(d1)) is a void method call, and thus it cannot be parameterized
   Expression assertEquals(Color.green,r1.getUpPaint()) is a void method call, and thus it cannot be parameterized
   Expression assertTrue(d2.equals(d1)) is a void method call, and thus it cannot be parameterized

   4

       assertTrue(d2.equals(d1));

   3

       assertEquals(Color.red, r1.getDownPaint());

   3 | assertEquals(Color.red, r1.getDownPaint());
   3 | assertTrue(d1.equals(d2));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   assertEquals | assertTrue | METHOD_INVOCATION_NAME_MISMATCH
   assertEquals(Color.red,r1.getDownPaint()) | assertTrue(d1.equals(d2)) | ARGUMENT_NUMBER_MISMATCH

   Preondition Violations
   Expression assertEquals(Color.red,r1.getDownPaint()) is a void method call, and thus it cannot be parameterized
   Expression assertTrue(d1.equals(d2)) is a void method call, and thus it cannot be parameterized
   Expression assertEquals(Color.red,r1.getDownPaint()) is a void method call, and thus it cannot be parameterized
   Expression assertTrue(d1.equals(d2)) is a void method call, and thus it cannot be parameterized

   3

       assertTrue(d1.equals(d2));

   4

       assertFalse(r1.getUseOutlinePaint());

   5 | d1.addSeries(createSeries1());

   Preondition Violations
   Unmatched statement d1.addSeries(createSeries1()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   5

       d1.addSeries(createSeries1());

   5

       assertTrue(r1.getDrawVolume());

   7 | d2.addSeries(createSeries1());

   Preondition Violations
   Unmatched statement d2.addSeries(createSeries1()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   7

       d2.addSeries(createSeries1());

   6

       assertEquals(Color.gray, r1.getVolumePaint());

   6 | assertEquals(Color.gray, r1.getVolumePaint());
   8 | assertTrue(d1.equals(d2));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   assertEquals | assertTrue | METHOD_INVOCATION_NAME_MISMATCH
   assertEquals(Color.gray,r1.getVolumePaint()) | assertTrue(d1.equals(d2)) | ARGUMENT_NUMBER_MISMATCH

   Preondition Violations
   Expression assertEquals(Color.gray,r1.getVolumePaint()) is a void method call, and thus it cannot be parameterized
   Expression assertTrue(d1.equals(d2)) is a void method call, and thus it cannot be parameterized
   Expression assertEquals(Color.gray,r1.getVolumePaint()) is a void method call, and thus it cannot be parameterized
   Expression assertTrue(d1.equals(d2)) is a void method call, and thus it cannot be parameterized

   8

       assertTrue(d1.equals(d2));

   7

       assertEquals(-1.0, r1.getCandleWidth(), EPSILON);

   7 | assertEquals(-1.0, r1.getCandleWidth(), EPSILON);
   6 | assertFalse(d1.equals(d2));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   assertEquals | assertFalse | METHOD_INVOCATION_NAME_MISMATCH
   assertEquals(-1.0,r1.getCandleWidth(),EPSILON) | assertFalse(d1.equals(d2)) | ARGUMENT_NUMBER_MISMATCH

   Preondition Violations
   Expression assertEquals(-1.0,r1.getCandleWidth(),EPSILON) is a void method call, and thus it cannot be parameterized
   Expression assertFalse(d1.equals(d2)) is a void method call, and thus it cannot be parameterized
   Expression assertEquals(-1.0,r1.getCandleWidth(),EPSILON) is a void method call, and thus it cannot be parameterized
   Expression assertFalse(d1.equals(d2)) is a void method call, and thus it cannot be parameterized

   6

       assertFalse(d1.equals(d2));

   Precondition Violations (18)
   Row | Violation
   --- | ---
   1 | Expression assertEquals(Color.green,r1.getUpPaint()) is a void method call, and thus it cannot be parameterized
   2 | Expression assertTrue(d2.equals(d1)) is a void method call, and thus it cannot be parameterized
   3 | Expression assertEquals(Color.green,r1.getUpPaint()) is a void method call, and thus it cannot be parameterized
   4 | Expression assertTrue(d2.equals(d1)) is a void method call, and thus it cannot be parameterized
   5 | Expression assertEquals(Color.red,r1.getDownPaint()) is a void method call, and thus it cannot be parameterized
   6 | Expression assertTrue(d1.equals(d2)) is a void method call, and thus it cannot be parameterized
   7 | Expression assertEquals(Color.red,r1.getDownPaint()) is a void method call, and thus it cannot be parameterized
   8 | Expression assertTrue(d1.equals(d2)) is a void method call, and thus it cannot be parameterized
   9 | Unmatched statement d1.addSeries(createSeries1()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   10 | Unmatched statement d2.addSeries(createSeries1()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   11 | Expression assertEquals(Color.gray,r1.getVolumePaint()) is a void method call, and thus it cannot be parameterized
   12 | Expression assertTrue(d1.equals(d2)) is a void method call, and thus it cannot be parameterized
   13 | Expression assertEquals(Color.gray,r1.getVolumePaint()) is a void method call, and thus it cannot be parameterized
   14 | Expression assertTrue(d1.equals(d2)) is a void method call, and thus it cannot be parameterized
   15 | Expression assertEquals(-1.0,r1.getCandleWidth(),EPSILON) is a void method call, and thus it cannot be parameterized
   16 | Expression assertFalse(d1.equals(d2)) is a void method call, and thus it cannot be parameterized
   17 | Expression assertEquals(-1.0,r1.getCandleWidth(),EPSILON) is a void method call, and thus it cannot be parameterized
   18 | Expression assertFalse(d1.equals(d2)) is a void method call, and thus it cannot be parameterized