290-1-2

Locale saved = Locale.getDefault(); Locale.setDefault(Locale.ITALY); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/Rome")); Calendar cal = Calendar.getInstance(Locale.ITALY); cal.set(2006, Calendar.JANUARY, 16, 3, 47, 59); cal.set(Calendar.MILLISECOND, 999); Minute m = new Minute(47, 3, 16, 1, 2006); assertEquals(cal.getTime(), m.getEnd()); Locale.setDefault(saved); TimeZone.setDefault(savedZone);
Locale saved = Locale.getDefault(); Locale.setDefault(Locale.ITALY); TimeZone savedZone = TimeZone.getDefault(); TimeZone.setDefault(TimeZone.getTimeZone("Europe/Rome")); Calendar cal = Calendar.getInstance(Locale.ITALY); cal.set(2006, Calendar.JANUARY, 16, 3, 47, 0); cal.set(Calendar.MILLISECOND, 0); Minute m = new Minute(47, 3, 16, 1, 2006); assertEquals(cal.getTime(), m.getStart()); 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/MinuteTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/data/time/junit/MinuteTests.java
Method name: `void testGetEnd()` |  | Method name: `void testGetStart()`
Number of AST nodes: 11 |  | Number of AST nodes: 11

1

    Locale saved = Locale.getDefault();↵

1

    Locale saved = Locale.getDefault();↵

2

            Locale.setDefault(Locale.ITALY);↵

2

            Locale.setDefault(Locale.ITALY);↵

3

            TimeZone savedZone = TimeZone.getDefault();↵

3

            TimeZone savedZone = TimeZone.getDefault();↵

4

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

4

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

5

            Calendar cal = Calendar.getInstance(Locale.ITALY);↵

5

            Calendar cal = Calendar.getInstance(Locale.ITALY);↵

6

            cal.set(2006, Calendar.JANUARY, 16, 3, 47, 59);↵

6

            cal.set(2006, Calendar.JANUARY, 16, 3, 47, 0);↵

7

            cal.set(Calendar.MILLISECOND, 999);↵

7

            cal.set(Calendar.MILLISECOND, 0);↵

8

            Minute m = new Minute(47, 3, 16, 1, 2006);↵

8

            Minute m = new Minute(47, 3, 16, 1, 2006);↵

9

            assertEquals(cal.getTime(), m.getEnd());↵

9

            assertEquals(cal.getTime(), m.getStart());↵

10

            Locale.setDefault(saved);↵

10

            Locale.setDefault(saved);       ↵

11

            TimeZone.setDefault(savedZone);

11

            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 | 57

1. {Non-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) | 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.ITALY);

   2

       Locale.setDefault(Locale.ITALY);

   3

       TimeZone savedZone = TimeZone.getDefault();

   3

       TimeZone savedZone = TimeZone.getDefault();

   4

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

   4

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

   5

       Calendar cal = Calendar.getInstance(Locale.ITALY);

   5

       Calendar cal = Calendar.getInstance(Locale.ITALY);

   6

       cal.set(2006, Calendar.JANUARY, 16, 3, 47, 59);

   6 | cal.set(2006, Calendar.JANUARY, 16, 3, 47, 59);
   6 | cal.set(2006, Calendar.JANUARY, 16, 3, 47, 0);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   59 | 0 | LITERAL_VALUE_MISMATCH

   6

       cal.set(2006, Calendar.JANUARY, 16, 3, 47, 0);

   7

       cal.set(Calendar.MILLISECOND, 999);

   7 | cal.set(Calendar.MILLISECOND, 999);
   7 | cal.set(Calendar.MILLISECOND, 0);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   999 | 0 | LITERAL_VALUE_MISMATCH

   7

       cal.set(Calendar.MILLISECOND, 0);

   8

       Minute m = new Minute(47, 3, 16, 1, 2006);

   8

       Minute m = new Minute(47, 3, 16, 1, 2006);

   9

       assertEquals(cal.getTime(), m.getEnd());

   9 | assertEquals(cal.getTime(), m.getEnd());
   9 | assertEquals(cal.getTime(), m.getStart());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getEnd | getStart | METHOD_INVOCATION_NAME_MISMATCH

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

   9

       assertEquals(cal.getTime(), m.getStart());

   10

       Locale.setDefault(saved);

   10

       Locale.setDefault(saved);

   11

       TimeZone.setDefault(savedZone);

   11

       TimeZone.setDefault(savedZone);

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