377-5-13

Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Quarter q = new Quarter(3, 1970); assertEquals(23583599999L, q.getLastMillisecond()); Locale.setDefault(saved); TimeZone.setDefault(savedZone);
Locale saved = Locale.getDefault(); Locale.setDefault(Locale.UK); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/London")); Day d = new Day(1, 1, 1970); assertEquals(82799999L, d.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/QuarterTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/data/time/junit/DayTests.java
Method name: `void testGetLastMillisecond()` |  | 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

            Quarter q = new Quarter(3, 1970);↵

5

            Day d = new Day(1, 1, 1970);↵

6

            assertEquals(23583599999L, q.getLastMillisecond());↵

6

            assertEquals(82799999L, d.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 | 1
Number of non-refactorable cases | 0
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 | 50

1. {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

       Quarter q = new Quarter(3, 1970);

   5 | Quarter q = new Quarter(3, 1970);
   5 | Day d = new Day(1, 1, 1970);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.time.Quarter | org.jfree.data.time.Day | SUBCLASS_TYPE_MISMATCH
   q | d | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.Quarter | org.jfree.data.time.Day | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.time.Quarter | org.jfree.data.time.Day | SUBCLASS_TYPE_MISMATCH
   new Quarter(3,1970) | new Day(1,1,1970) | ARGUMENT_NUMBER_MISMATCH

   5

       Day d = new Day(1, 1, 1970);

   6

       assertEquals(23583599999L, q.getLastMillisecond());

   6 | assertEquals(23583599999L, q.getLastMillisecond());
   6 | assertEquals(82799999L, d.getLastMillisecond());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   23583599999L | 82799999L | LITERAL_VALUE_MISMATCH
   q | d | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.Quarter | org.jfree.data.time.Day | SUBCLASS_TYPE_MISMATCH

   6

       assertEquals(82799999L, d.getLastMillisecond());

   7

       Locale.setDefault(saved);

   7

       Locale.setDefault(saved);

   8

       TimeZone.setDefault(savedZone);

   8

       TimeZone.setDefault(savedZone);

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