Day d = new Day(1, 12, 2001); GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY); calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt")); assertEquals(1007164800000L, d.getFirstMillisecond(calendar)); // try null calendar boolean pass = false; try { d.getFirstMillisecond((Calendar) null); } catch (NullPointerException e) { pass = true; } assertTrue(pass);
Day d = new Day(4, 5, 2001); Calendar calendar = Calendar.getInstance( TimeZone.getTimeZone("Europe/London"), Locale.UK); assertEquals(989017199999L, d.getLastMillisecond(calendar)); // try null calendar boolean pass = false; try { d.getLastMillisecond((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/DayTests.java File path: /jfreechart-1.0.10/tests/org/jfree/data/time/junit/DayTests.java
Method name: void testGetFirstMillisecondWithCalendar() Method name: void testGetLastMillisecondWithCalendar()
Number of AST nodes: 8 Number of AST nodes: 7
1
Day d = new Day(1, 12, 2001);
1
Day d = new Day(4, 5, 2001);
2
        GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
2
        Calendar calendar = 
3
        calendar.setTimeZone(
3
Calendar.getInstance(
4
TimeZone.getTimeZone("Europe/Frankfurt"));
4
                TimeZone.getTimeZone("Europe/London"), Locale.UK);
5
        assertEquals(1007164800000L, d.getFirstMillisecond(calendar));
5
        assertEquals(989017199999L, d.getLastMillisecond(calendar));
6
        
6
        
7
        // try null calendar
7
        // try null calendar
8
        boolean pass = false;
8
        boolean pass = false;
9
        try {
9
        try {
10
            d.getFirstMillisecond((Calendar) null);
10
            d.getLastMillisecond((Calendar) null);
11
        }
11
        }
12
        catch (NullPointerException e) {
12
        catch (NullPointerException e) {
13
            pass = true;
13
            pass = true;
14
        }
14
        }
15
        assertTrue(pass);
15
        assertTrue(pass);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are declared in the same class
Number of node comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)7.3
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    Day d = new Day(1, 12, 2001);
    1
    Day d = new Day(1, 12, 2001);
    1
    Day d = new Day(4, 5, 2001);
    Differences
    Expression1Expression2Difference
    14LITERAL_VALUE_MISMATCH
    125LITERAL_VALUE_MISMATCH
    1
    Day d = new Day(4, 5, 2001);
    2
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    2
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    2
    Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("Europe/London"), Locale.UK);
    Differences
    Expression1Expression2Difference
    java.util.GregorianCalendarjava.util.CalendarSUBCLASS_TYPE_MISMATCH
    java.util.GregorianCalendarjava.util.CalendarSUBCLASS_TYPE_MISMATCH
    java.util.GregorianCalendarjava.util.CalendarSUBCLASS_TYPE_MISMATCH
    new GregorianCalendar(Locale.GERMANY)Calendar.getInstance(TimeZone.getTimeZone("Europe/London"),Locale.UK)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression new GregorianCalendar(Locale.GERMANY) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("Europe/London"), Locale.UK);
    3
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    3
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    Preondition Violations
    Unmatched statement calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt")); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                        
    4
    assertEquals(1007164800000L, d.getFirstMillisecond(calendar));
    4
    assertEquals(1007164800000L, d.getFirstMillisecond(calendar));
    3
    assertEquals(989017199999L, d.getLastMillisecond(calendar));
    Differences
    Expression1Expression2Difference
    1007164800000L989017199999LLITERAL_VALUE_MISMATCH
    java.util.GregorianCalendarjava.util.CalendarSUBCLASS_TYPE_MISMATCH
    getFirstMillisecondgetLastMillisecondMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression d.getFirstMillisecond(calendar) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression d.getLastMillisecond(calendar) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    assertEquals(989017199999L, d.getLastMillisecond(calendar));
    5
    boolean pass = false;
    4
    boolean pass = false;
    6
    try
    5
    try
    7
    d.getFirstMillisecond((Calendar)null);
    7
    d.getFirstMillisecond((Calendar)null);
    6
    d.getLastMillisecond((Calendar)null);
    Differences
    Expression1Expression2Difference
    getFirstMillisecondgetLastMillisecondMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression d.getFirstMillisecond((Calendar)null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression d.getLastMillisecond((Calendar)null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression d.getFirstMillisecond((Calendar)null) is a void method call, and thus it cannot be parameterized
    Expression d.getLastMillisecond((Calendar)null) is a void method call, and thus it cannot be parameterized
    6
    d.getLastMillisecond((Calendar)null);
    8
    assertTrue(pass);
    7
    assertTrue(pass);
    Precondition Violations (8)
    Row Violation
    1Expression new GregorianCalendar(Locale.GERMANY) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Unmatched statement calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt")); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Expression d.getFirstMillisecond(calendar) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression d.getLastMillisecond(calendar) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression d.getFirstMillisecond((Calendar)null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression d.getLastMillisecond((Calendar)null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression d.getFirstMillisecond((Calendar)null) is a void method call, and thus it cannot be parameterized
    8Expression d.getLastMillisecond((Calendar)null) is a void method call, and thus it cannot be parameterized