1263-5-8

Locale saved = Locale.getDefault(); Locale.setDefault(Locale.ITALY); Calendar cal = Calendar.getInstance(Locale.ITALY); cal.set(2006, Calendar.JANUARY, 16, 0, 0, 0); cal.set(Calendar.MILLISECOND, 0); Week w = new Week(3, 2006); assertEquals(cal.getTime(), w.getStart()); Locale.setDefault(saved);
Locale saved = Locale.getDefault(); Locale.setDefault(Locale.ITALY); Calendar cal = Calendar.getInstance(Locale.ITALY); cal.set(2006, Calendar.DECEMBER, 31, 23, 59, 59); cal.set(Calendar.MILLISECOND, 999); Year y = new Year(2006); assertEquals(cal.getTime(), y.getEnd()); Locale.setDefault(saved);

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

1

    Locale saved = Locale.getDefault();↵

1

    Locale saved = Locale.getDefault();↵

2

            Locale.setDefault(Locale.ITALY);↵

2

            Locale.setDefault(Locale.ITALY);↵

3

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

3

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

4

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

4

            cal.set(2006, Calendar.DECEMBER, 31, 23, 59, 59);↵

5

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

5

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

6

            Week w = new Week(3, 2006);↵

6

            Year y = new Year(2006);↵

7

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

7

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

8

            Locale.setDefault(saved);

8

            Locale.setDefault(saved);

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 in different classes having the same super class
Number of node comparisons | 30

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

   2

       Locale.setDefault(Locale.ITALY);

   3

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

   3

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

   4

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

   4 | cal.set(2006, Calendar.JANUARY, 16, 0, 0, 0);
   4 | cal.set(2006, Calendar.DECEMBER, 31, 23, 59, 59);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   JANUARY | DECEMBER | VARIABLE_NAME_MISMATCH
   16 | 31 | LITERAL_VALUE_MISMATCH
   0 | 23 | LITERAL_VALUE_MISMATCH
   0 | 59 | LITERAL_VALUE_MISMATCH
   0 | 59 | LITERAL_VALUE_MISMATCH

   4

       cal.set(2006, Calendar.DECEMBER, 31, 23, 59, 59);

   5

       cal.set(Calendar.MILLISECOND, 0);

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

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

   5

       cal.set(Calendar.MILLISECOND, 999);

   6

       Week w = new Week(3, 2006);

   6 | Week w = new Week(3, 2006);
   6 | Year y = new Year(2006);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.time.Week | org.jfree.data.time.Year | SUBCLASS_TYPE_MISMATCH
   w | y | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.Week | org.jfree.data.time.Year | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.time.Week | org.jfree.data.time.Year | SUBCLASS_TYPE_MISMATCH
   new Week(3,2006) | new Year(2006) | ARGUMENT_NUMBER_MISMATCH

   6

       Year y = new Year(2006);

   7

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

   7 | assertEquals(cal.getTime(), w.getStart());
   7 | assertEquals(cal.getTime(), y.getEnd());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getStart | getEnd | METHOD_INVOCATION_NAME_MISMATCH
   w | y | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.Week | org.jfree.data.time.Year | SUBCLASS_TYPE_MISMATCH

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

   7

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

   8

       Locale.setDefault(saved);

   8

       Locale.setDefault(saved);

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