113-2-3

DefaultWindDataset d = createSampleDataset1(); assertEquals("Series 1", d.getSeriesKey(0)); assertEquals("Series 2", d.getSeriesKey(1)); // check for series key out of bounds boolean pass = false; try { /*Comparable k =*/ d.getSeriesKey(-1); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass); pass = false; try { /*Comparable k =*/ d.getSeriesKey(2); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass);
DefaultXYZDataset d = createSampleDataset1(); assertEquals("S1", d.getSeriesKey(0)); assertEquals("S2", d.getSeriesKey(1)); // check for series key out of bounds boolean pass = false; try { /*Comparable k =*/ d.getSeriesKey(-1); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass); pass = false; try { /*Comparable k =*/ d.getSeriesKey(2); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/DefaultWindDatasetTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/DefaultXYZDatasetTests.java
Method name: `void testGetSeriesKey()` |  | Method name: `void testGetSeriesKey()`
Number of AST nodes: 11 |  | Number of AST nodes: 11

1

    DefaultWindDataset d = createSampleDataset1();↵

1

    DefaultXYZDataset d = createSampleDataset1();↵

2

            assertEquals("Series 1", d.getSeriesKey(0));↵

2

            assertEquals("S1", d.getSeriesKey(0));↵

3

            assertEquals("Series 2", d.getSeriesKey(1));↵

3

            assertEquals("S2", d.getSeriesKey(1));↵

4

            // check for series key out of bounds↵

4

            // check for series key out of bounds↵

5

            boolean pass = false;↵

5

            boolean pass = false;↵

6

            try {↵

6

            try {↵

7

                /*Comparable k =*/ d.getSeriesKey(-1);↵

7

                /*Comparable k =*/ d.getSeriesKey(-1);↵

8

            }↵

8

            }↵

9

            catch (IllegalArgumentException e) {↵

9

            catch (IllegalArgumentException e) {↵

10

                pass = true;↵

10

                pass = true;↵

11

            }↵

11

            }↵

12

            assertTrue(pass);↵

12

            assertTrue(pass);↵

13

            pass = false;↵

13

            pass = false;↵

14

            try {↵

14

            try {↵

15

                /*Comparable k =*/ d.getSeriesKey(2);↵

15

                /*Comparable k =*/ d.getSeriesKey(2);↵

16

            }↵

16

            }↵

17

            catch (IllegalArgumentException e) {↵

17

            catch (IllegalArgumentException e) {↵

18

                pass = true;↵

18

                pass = true;↵

19

            }↵

19

            }↵

20

            assertTrue(pass);

20

            assertTrue(pass);

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.2
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 42

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 11
   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) | 3.0
   Clone type | Type 2

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

   1

       DefaultWindDataset d = createSampleDataset1();

   1 | DefaultWindDataset d = createSampleDataset1();
   1 | DefaultXYZDataset d = createSampleDataset1();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.DefaultWindDataset | org.jfree.data.xy.DefaultXYZDataset | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.xy.DefaultWindDataset | org.jfree.data.xy.DefaultXYZDataset | SUBCLASS_TYPE_MISMATCH

   1

       DefaultXYZDataset d = createSampleDataset1();

   2

       assertEquals("Series 1", d.getSeriesKey(0));

   2 | assertEquals("Series 1", d.getSeriesKey(0));
   2 | assertEquals("S1", d.getSeriesKey(0));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   "Series 1" | "S1" | LITERAL_VALUE_MISMATCH
   org.jfree.data.xy.DefaultWindDataset | org.jfree.data.xy.DefaultXYZDataset | SUBCLASS_TYPE_MISMATCH

   2

       assertEquals("S1", d.getSeriesKey(0));

   3

       assertEquals("Series 2", d.getSeriesKey(1));

   3 | assertEquals("Series 2", d.getSeriesKey(1));
   3 | assertEquals("S2", d.getSeriesKey(1));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   "Series 2" | "S2" | LITERAL_VALUE_MISMATCH
   org.jfree.data.xy.DefaultWindDataset | org.jfree.data.xy.DefaultXYZDataset | SUBCLASS_TYPE_MISMATCH

   3

       assertEquals("S2", d.getSeriesKey(1));

   4

       boolean pass = false;

   4

       boolean pass = false;

   5

       try

   5

       try

   6

       d.getSeriesKey(-1);

   6 | d.getSeriesKey(-1);
   6 | d.getSeriesKey(-1);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.DefaultWindDataset | org.jfree.data.xy.DefaultXYZDataset | SUBCLASS_TYPE_MISMATCH

   6

       d.getSeriesKey(-1);

   7

       assertTrue(pass);

   7

       assertTrue(pass);

   8

       pass = false;

   8

       pass = false;

   9

       try

   9

       try

   10

       d.getSeriesKey(2);

   10 | d.getSeriesKey(2);
   10 | d.getSeriesKey(2);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.DefaultWindDataset | org.jfree.data.xy.DefaultXYZDataset | SUBCLASS_TYPE_MISMATCH

   10

       d.getSeriesKey(2);

   11

       assertTrue(pass);

   11

       assertTrue(pass);

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