Week w = new Week(47, 1950); Locale saved = Locale.getDefault(); Locale.setDefault(Locale.US); try { TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles"); assertEquals(-603302400000L, w.getFirstMillisecond(zone)); } finally { Locale.setDefault(saved); } // try null calendar boolean pass = false; try { w.getFirstMillisecond((TimeZone) null); } catch (NullPointerException e) { pass = true; } assertTrue(pass);
Week w = new Week(2, 1950); Locale saved = Locale.getDefault(); Locale.setDefault(Locale.US); try { TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles"); assertEquals(-629913600001L, w.getLastMillisecond(zone)); } finally { Locale.setDefault(saved); } // try null zone boolean pass = false; try { w.getLastMillisecond((TimeZone) 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/WeekTests.java File path: /jfreechart-1.0.10/tests/org/jfree/data/time/junit/WeekTests.java
Method name: void testGetFirstMillisecondWithTimeZone() Method name: void testGetLastMillisecondWithTimeZone()
Number of AST nodes: 10 Number of AST nodes: 10
1
Week w = new Week(47, 1950);
1
Week w = new Week(2, 1950);
2
        Locale saved = Locale.getDefault();
2
        Locale saved = Locale.getDefault();
3
        Locale.setDefault(Locale.US);
3
        Locale.setDefault(Locale.US);
4
        try {
4
        try {
5
            TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
5
            TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
6
            assertEquals(-603302400000L, w.getFirstMillisecond(zone));
6
            assertEquals(-629913600001L, w.getLastMillisecond(zone));
7
        }
7
        }
8
        finally {
8
        finally {
9
            Locale.setDefault(saved);
9
            Locale.setDefault(saved);
10
        }
10
        }
11
        
12
        // try null calendar
11
        // try null zone
13
        boolean pass = false;
12
        boolean pass = false;
14
        try {
13
        try {
15
            w.getFirstMillisecond((TimeZone) null);
14
            w.getLastMillisecond((TimeZone) null);
16
        }
15
        }
17
        catch (NullPointerException e) {
16
        catch (NullPointerException e) {
18
            pass = true;
17
            pass = true;
19
        }        
18
        }
20
        assertTrue(pass);
19
        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.2
Clones locationClones are declared in the same class
Number of node comparisons32
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)9.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Week w = new Week(47, 1950);
    1
    Week w = new Week(47, 1950);
    1
    Week w = new Week(2, 1950);
    Differences
    Expression1Expression2Difference
    472LITERAL_VALUE_MISMATCH
    1
    Week w = new Week(2, 1950);
    2
    Locale saved = Locale.getDefault();
    2
    Locale saved = Locale.getDefault();
    3
    Locale.setDefault(Locale.US);
    3
    Locale.setDefault(Locale.US);
    4
    try
    4
    try
    5
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    5
    TimeZone zone = TimeZone.getTimeZone("America/Los_Angeles");
    6
    assertEquals(-603302400000L, w.getFirstMillisecond(zone));
    6
    assertEquals(-603302400000L, w.getFirstMillisecond(zone));
    6
    assertEquals(-629913600001L, w.getLastMillisecond(zone));
    Differences
    Expression1Expression2Difference
    603302400000L629913600001LLITERAL_VALUE_MISMATCH
    getFirstMillisecondgetLastMillisecondMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression w.getFirstMillisecond(zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression w.getLastMillisecond(zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    assertEquals(-629913600001L, w.getLastMillisecond(zone));
    7
    boolean pass = false;
    7
    boolean pass = false;
    8
    try
    8
    try
    9
    w.getFirstMillisecond((TimeZone)null);
    9
    w.getFirstMillisecond((TimeZone)null);
    9
    w.getLastMillisecond((TimeZone)null);
    Differences
    Expression1Expression2Difference
    getFirstMillisecondgetLastMillisecondMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression w.getFirstMillisecond((TimeZone)null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression w.getLastMillisecond((TimeZone)null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression w.getFirstMillisecond((TimeZone)null) is a void method call, and thus it cannot be parameterized
    Expression w.getLastMillisecond((TimeZone)null) is a void method call, and thus it cannot be parameterized
    9
    w.getLastMillisecond((TimeZone)null);
    10
    assertTrue(pass);
    10
    assertTrue(pass);
    Precondition Violations (6)
    Row Violation
    1Expression w.getFirstMillisecond(zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression w.getLastMillisecond(zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression w.getFirstMillisecond((TimeZone)null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression w.getLastMillisecond((TimeZone)null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression w.getFirstMillisecond((TimeZone)null) is a void method call, and thus it cannot be parameterized
    6Expression w.getLastMillisecond((TimeZone)null) is a void method call, and thus it cannot be parameterized