377-6-7

Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Millisecond m = new Millisecond(500, 15, 43, 15, 1, 4, 2006); assertEquals(1143902595500L, m.getFirstMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone);
Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Millisecond m = new Millisecond(750, 1, 1, 1, 1, 1, 1970); assertEquals(61750L, m.getLastMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone);

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

1

    Locale saved = Locale.getDefault();↵

1

    Locale saved = Locale.getDefault();↵

2

            Locale.setDefault(Locale.UK);↵

2

            Locale.setDefault(Locale.UK);↵

3

            TimeZone savedZone = TimeZone.getDefault();↵

3

            TimeZone savedZone = TimeZone.getDefault();↵

4

            TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));↵

4

            TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));↵

5

            Millisecond m = new Millisecond(500, 15, 43, 15, 1, 4, 2006);↵

5

            Millisecond m = new Millisecond(750, 1, 1, 1, 1, 1, 1970);↵

6

            assertEquals(1143902595500L, m.getFirstMillisecond());↵

6

            assertEquals(61750L, m.getLastMillisecond());↵

7

            Locale.setDefault(saved);↵

7

            Locale.setDefault(saved);↵

8

            TimeZone.setDefault(savedZone);

8

            TimeZone.setDefault(savedZone);

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 declared in the same class
Number of node comparisons | 50

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) | 0.0
   Clone type | Type 2

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

   1

       Locale saved = Locale.getDefault();

   1

       Locale saved = Locale.getDefault();

   2

       Locale.setDefault(Locale.UK);

   2

       Locale.setDefault(Locale.UK);

   3

       TimeZone savedZone = TimeZone.getDefault();

   3

       TimeZone savedZone = TimeZone.getDefault();

   4

       TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));

   4

       TimeZone.setDefault(TimeZone.getTimeZone("Europe/London"));

   5

       Millisecond m = new Millisecond(500, 15, 43, 15, 1, 4, 2006);

   5 | Millisecond m = new Millisecond(500, 15, 43, 15, 1, 4, 2006);
   5 | Millisecond m = new Millisecond(750, 1, 1, 1, 1, 1, 1970);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   500 | 750 | LITERAL_VALUE_MISMATCH
   15 | 1 | LITERAL_VALUE_MISMATCH
   43 | 1 | LITERAL_VALUE_MISMATCH
   15 | 1 | LITERAL_VALUE_MISMATCH
   4 | 1 | LITERAL_VALUE_MISMATCH
   2006 | 1970 | LITERAL_VALUE_MISMATCH

   5

       Millisecond m = new Millisecond(750, 1, 1, 1, 1, 1, 1970);

   6

       assertEquals(1143902595500L, m.getFirstMillisecond());

   6 | assertEquals(1143902595500L, m.getFirstMillisecond());
   6 | assertEquals(61750L, m.getLastMillisecond());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   1143902595500L | 61750L | LITERAL_VALUE_MISMATCH
   getFirstMillisecond | getLastMillisecond | METHOD_INVOCATION_NAME_MISMATCH

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

   6

       assertEquals(61750L, m.getLastMillisecond());

   7

       Locale.setDefault(saved);

   7

       Locale.setDefault(saved);

   8

       TimeZone.setDefault(savedZone);

   8

       TimeZone.setDefault(savedZone);

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