TimeZone zone = TimeZone.getTimeZone("Australia/Sydney"); Hour h1 = new Hour(new Date(1014267599999L), zone); Hour h2 = new Hour (new Date(1014267600000L), zone); assertEquals(15, h1.getHour()); assertEquals(1014267599999L, h1.getLastMillisecond(zone)); assertEquals(16, h2.getHour()); assertEquals(1014267600000L, h2.getFirstMillisecond(zone));
try { TimeZone zone = TimeZone.getTimeZone("GMT"); GregorianCalendar gc = new GregorianCalendar(zone); gc.set(2005, Calendar.JANUARY, 1, 12, 0, 0); Week w = new Week(gc.getTime(), zone); assertEquals(53, w.getWeek()); assertEquals(new Year(2004), w.getYear()); } finally { Locale.setDefault(saved); }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/data/time/junit/HourTests.java File path: /jfreechart-1.0.10/tests/org/jfree/data/time/junit/WeekTests.java
Method name: void testDateConstructor2() Method name: void testBug1498805()
Number of AST nodes: 7 Number of AST nodes: 7
1
try {
1
TimeZone zone = TimeZone.getTimeZone("Australia/Sydney");
2
            TimeZone zone = TimeZone.getTimeZone("
2
        Hour h1 = new Hour(new Date(1014267599999L), zone);
3
        Hour h2 = new Hour (new Date(1014267600000L
3
GMT");
4
            GregorianCalendar gc = new GregorianCalendar(zone);
5
            gc.set(2005, Calendar.JANUARY, 1, 12, 0, 0);
4
), zone);
6
            Week w = new Week(gc.getTime(), zone);
5
        assertEquals(15, h1.getHour());
7
            assertEquals(53, w.getWeek());
6
        assertEquals(1014267599999L, h1.getLastMillisecond(zone));
8
            assertEquals(
7
        assertEquals(16, h2.getHour());
8
        assertEquals(1014267600000L, h2.getFirstMillisecond(zone));
9
new Year(2004), w.getYear());
10
        }
11
        finally {
12
            Locale.setDefault(saved);
13
        }
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.0
Clones locationClones are in different classes having the same super class
Number of node comparisons33
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    TimeZone zone = TimeZone.getTimeZone("Australia/Sydney");
    1
    TimeZone zone = TimeZone.getTimeZone("Australia/Sydney");
    4
    TimeZone zone = TimeZone.getTimeZone("GMT");
    Differences
    Expression1Expression2Difference
    "Australia/Sydney""GMT"LITERAL_VALUE_MISMATCH
    4
    TimeZone zone = TimeZone.getTimeZone("GMT");
                                                                                                            
    5
    GregorianCalendar gc = new GregorianCalendar(zone);
    Preondition Violations
    Unmatched statement GregorianCalendar gc=new GregorianCalendar(zone); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    GregorianCalendar gc = new GregorianCalendar(zone);
                                                                                        
    6
    gc.set(2005, Calendar.JANUARY, 1, 12, 0, 0);
    Preondition Violations
    Unmatched statement gc.set(2005,Calendar.JANUARY,1,12,0,0); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6
    gc.set(2005, Calendar.JANUARY, 1, 12, 0, 0);
    2
    Hour h1 = new Hour(new Date(1014267599999L), zone);
    2
    Hour h1 = new Hour(new Date(1014267599999L), zone);
    7
    Week w = new Week(gc.getTime(), zone);
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.Hourorg.jfree.data.time.WeekSUBCLASS_TYPE_MISMATCH
    h1wVARIABLE_NAME_MISMATCH
    org.jfree.data.time.Hourorg.jfree.data.time.WeekSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.Hourorg.jfree.data.time.WeekSUBCLASS_TYPE_MISMATCH
    new Date(1014267599999L)gc.getTime()TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression new Hour(new Date(1014267599999L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new Week(gc.getTime(),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression gc.getTime() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7
    Week w = new Week(gc.getTime(), zone);
    3
    Hour h2 = new Hour(new Date(1014267600000L), zone);
    3
    Hour h2 = new Hour(new Date(1014267600000L), zone);
    Preondition Violations
    Unmatched statement Hour h2=new Hour(new Date(1014267600000L),zone); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                          
    4
    assertEquals(15, h1.getHour());
    4
    assertEquals(15, h1.getHour());
    8
    assertEquals(53, w.getWeek());
    Differences
    Expression1Expression2Difference
    1553LITERAL_VALUE_MISMATCH
    getHourgetWeekMETHOD_INVOCATION_NAME_MISMATCH
    h1wVARIABLE_NAME_MISMATCH
    org.jfree.data.time.Hourorg.jfree.data.time.WeekSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression h1.getHour() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression w.getWeek() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression h1 cannot be unified with expression w , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public int getHour() , public int getWeek()
    8
    assertEquals(53, w.getWeek());
    5
    assertEquals(1014267599999L, h1.getLastMillisecond(zone));
    5
    assertEquals(1014267599999L, h1.getLastMillisecond(zone));
    Preondition Violations
    Unmatched statement assertEquals(1014267599999L,h1.getLastMillisecond(zone)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                            
    6
    assertEquals(16, h2.getHour());
                                                                      
    7
    assertEquals(1014267600000L, h2.getFirstMillisecond(zone));
    7
    assertEquals(1014267600000L, h2.getFirstMillisecond(zone));
    Preondition Violations
    Unmatched statement assertEquals(1014267600000L,h2.getFirstMillisecond(zone)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                              
                                                                                            
    9
    assertEquals(new Year(2004), w.getYear());
    Preondition Violations
    Unmatched statement assertEquals(new Year(2004),w.getYear()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9
    assertEquals(new Year(2004), w.getYear());
    Precondition Violations (13)
    Row Violation
    1Unmatched statement GregorianCalendar gc=new GregorianCalendar(zone); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement gc.set(2005,Calendar.JANUARY,1,12,0,0); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Expression new Hour(new Date(1014267599999L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression new Week(gc.getTime(),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression gc.getTime() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Unmatched statement Hour h2=new Hour(new Date(1014267600000L),zone); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Expression h1.getHour() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression w.getWeek() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression h1 cannot be unified with expression w , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public int getHour() , public int getWeek()
    10Unmatched statement assertEquals(1014267599999L,h1.getLastMillisecond(zone)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    11Unmatched statement assertEquals(1014267600000L,h2.getFirstMillisecond(zone)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    12Unmatched statement assertEquals(new Year(2004),w.getYear()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    13Clone fragment #1 returns variables zone, h1 , while Clone fragment #2 returns variables zone, w