237-8-14

Minute m = new Minute(45, 21, 21, 4, 2001); GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY); calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt")); assertEquals(987889559999L, m.getLastMillisecond(calendar)); // try null calendar boolean pass = false; try { m.getLastMillisecond((Calendar) null); } catch (NullPointerException e) { pass = true; } assertTrue(pass);
Hour h = new Hour(2, 15, 4, 2000); GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY); calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt")); assertEquals(955764000000L, h.getFirstMillisecond(calendar)); // try null calendar boolean pass = false; try { h.getFirstMillisecond((Calendar) null); } catch (NullPointerException e) { pass = true; } assertTrue(pass);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/data/time/junit/MinuteTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/data/time/junit/HourTests.java
Method name: `void testGetLastMillisecondWithCalendar()` |  | Method name: `void testGetFirstMillisecondWithCalendar()`
Number of AST nodes: 8 |  | Number of AST nodes: 8

1

    Minute m = new Minute(45, 21, 21, 4, 2001);↵

1

    Hour h = new Hour(2, 15, 4, 2000);↵

2

            GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);↵

2

            GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);↵

3

            calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));↵

3

            calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));↵

4

            assertEquals(987889559999L, m.getLastMillisecond(calendar));↵

4

            assertEquals(955764000000L, h.getFirstMillisecond(calendar));↵

5

            ↵

5

            ↵

6

            // try null calendar↵

6

            // try null calendar↵

7

            boolean pass = false;↵

7

            boolean pass = false;↵

8

            try {↵

8

            try {↵

9

                m.getLastMillisecond((Calendar) null);↵

9

                h.getFirstMillisecond((Calendar) null);↵

10

            }↵

10

            }↵

11

            catch (NullPointerException e) {↵

11

            catch (NullPointerException e) {↵

12

                pass = true;↵

12

                pass = true;↵

13

            }↵

13

            }↵

14

            assertTrue(pass);

14

            assertTrue(pass);

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

1. {Non-refactorable}

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

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

   1

       Minute m = new Minute(45, 21, 21, 4, 2001);

   1 | Minute m = new Minute(45, 21, 21, 4, 2001);
   1 | Hour h = new Hour(2, 15, 4, 2000);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.time.Minute | org.jfree.data.time.Hour | SUBCLASS_TYPE_MISMATCH
   m | h | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.Minute | org.jfree.data.time.Hour | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.time.Minute | org.jfree.data.time.Hour | SUBCLASS_TYPE_MISMATCH
   new Minute(45,21,21,4,2001) | new Hour(2,15,4,2000) | ARGUMENT_NUMBER_MISMATCH

   1

       Hour h = new Hour(2, 15, 4, 2000);

   2

       GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);

   2

       GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);

   3

       calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));

   3

       calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));

   4

       assertEquals(987889559999L, m.getLastMillisecond(calendar));

   4 | assertEquals(987889559999L, m.getLastMillisecond(calendar));
   4 | assertEquals(955764000000L, h.getFirstMillisecond(calendar));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   987889559999L | 955764000000L | LITERAL_VALUE_MISMATCH
   getLastMillisecond | getFirstMillisecond | METHOD_INVOCATION_NAME_MISMATCH
   m | h | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.Minute | org.jfree.data.time.Hour | SUBCLASS_TYPE_MISMATCH

   Preondition Violations
   Expression m.getLastMillisecond(calendar) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression h.getFirstMillisecond(calendar) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   4

       assertEquals(955764000000L, h.getFirstMillisecond(calendar));

   5

       boolean pass = false;

   5

       boolean pass = false;

   6

       try

   6

       try

   7

       m.getLastMillisecond((Calendar)null);

   7 | m.getLastMillisecond((Calendar)null);
   7 | h.getFirstMillisecond((Calendar)null);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getLastMillisecond | getFirstMillisecond | METHOD_INVOCATION_NAME_MISMATCH
   m | h | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.Minute | org.jfree.data.time.Hour | SUBCLASS_TYPE_MISMATCH

   Preondition Violations
   Expression m.getLastMillisecond((Calendar)null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression h.getFirstMillisecond((Calendar)null) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   7

       h.getFirstMillisecond((Calendar)null);

   8

       assertTrue(pass);

   8

       assertTrue(pass);

   Precondition Violations (4)
   Row | Violation
   --- | ---
   1 | Expression m.getLastMillisecond(calendar) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression h.getFirstMillisecond(calendar) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression m.getLastMillisecond((Calendar)null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression h.getFirstMillisecond((Calendar)null) cannot be parameterized, because it has dependencies to/from statements that will be extracted