Quarter q = new Quarter(3, 2001); GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY); calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt")); assertEquals(1001894399999L, q.getLastMillisecond(calendar)); // try null calendar boolean pass = false; try { q.getLastMillisecond((Calendar) null); } catch (NullPointerException e) { pass = true; } assertTrue(pass);
Year y = new Year(2001); GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY); calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt")); assertEquals(1009843199999L, y.getLastMillisecond(calendar)); // try null calendar boolean pass = false; try { y.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/QuarterTests.java File path: /jfreechart-1.0.10/tests/org/jfree/data/time/junit/YearTests.java
Method name: void testGetLastMillisecondWithCalendar() Method name: void testGetLastMillisecondWithCalendar()
Number of AST nodes: 8 Number of AST nodes: 8
1
Quarter q = new Quarter(3, 2001);
1
Year y = new Year(2001);
2
        GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
2
        GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
3
        calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
3
        calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
4
        assertEquals(1001894399999L, q.getLastMillisecond(calendar));
4
        assertEquals(1009843199999L, y.getLastMillisecond(calendar));
5
        
5
        
6
        // try null calendar
6
        // try null calendar
7
        boolean pass = false;
7
        boolean pass = false;
8
        try {
8
        try {
9
            q.getLastMillisecond((Calendar) null);
9
            y.getLastMillisecond((Calendar) null);
10
        }
10
        }
11
        catch (NullPointerException e) {
11
        catch (NullPointerException e) {
12
            pass = true;
12
            pass = true;
13
        }
13
        }
14
        assertTrue(pass);
14
        assertTrue(pass);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are in different classes having the same super class
Number of node comparisons18
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)12.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Quarter q = new Quarter(3, 2001);
    1
    Quarter q = new Quarter(3, 2001);
    1
    Year y = new Year(2001);
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.Quarterorg.jfree.data.time.YearSUBCLASS_TYPE_MISMATCH
    qyVARIABLE_NAME_MISMATCH
    org.jfree.data.time.Quarterorg.jfree.data.time.YearSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.Quarterorg.jfree.data.time.YearSUBCLASS_TYPE_MISMATCH
    new Quarter(3,2001)new Year(2001)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression new Quarter(3,2001) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new Year(2001) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new Quarter(3,2001) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new Year(2001) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    1
    Year y = new Year(2001);
    2
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    2
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    3
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    3
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    4
    assertEquals(1001894399999L, q.getLastMillisecond(calendar));
    4
    assertEquals(1001894399999L, q.getLastMillisecond(calendar));
    4
    assertEquals(1009843199999L, y.getLastMillisecond(calendar));
    Differences
    Expression1Expression2Difference
    1001894399999L1009843199999LLITERAL_VALUE_MISMATCH
    qyVARIABLE_NAME_MISMATCH
    org.jfree.data.time.Quarterorg.jfree.data.time.YearSUBCLASS_TYPE_MISMATCH
    4
    assertEquals(1009843199999L, y.getLastMillisecond(calendar));
    5
    boolean pass = false;
    5
    boolean pass = false;
    6
    try
    6
    try
    7
    q.getLastMillisecond((Calendar)null);
    7
    q.getLastMillisecond((Calendar)null);
    7
    y.getLastMillisecond((Calendar)null);
    Differences
    Expression1Expression2Difference
    qyVARIABLE_NAME_MISMATCH
    org.jfree.data.time.Quarterorg.jfree.data.time.YearSUBCLASS_TYPE_MISMATCH
    7
    y.getLastMillisecond((Calendar)null);
    8
    assertTrue(pass);
    8
    assertTrue(pass);
    Precondition Violations (4)
    Row Violation
    1Expression new Quarter(3,2001) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new Year(2001) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression new Quarter(3,2001) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression new Year(2001) cannot be parameterized, because it has dependencies to/from statements that will be extracted