TimeZone zone = TimeZone.getTimeZone("GMT"); Hour h1 = new Hour(new Date(1014307199999L), zone); Hour h2 = new Hour(new Date(1014307200000L), zone); assertEquals(15, h1.getHour()); assertEquals(1014307199999L, h1.getLastMillisecond(zone)); assertEquals(16, h2.getHour()); assertEquals(1014307200000L, h2.getFirstMillisecond(zone));
TimeZone zone = TimeZone.getTimeZone("GMT"); Second s1 = new Second(new Date(1016729758999L), zone); Second s2 = new Second(new Date(1016729759000L), zone); assertEquals(58, s1.getSecond()); assertEquals(1016729758999L, s1.getLastMillisecond(zone)); assertEquals(59, s2.getSecond()); assertEquals(1016729759000L, s2.getFirstMillisecond(zone));
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/SecondTests.java
Method name: void testDateConstructor1() Method name: void testDateConstructor1()
Number of AST nodes: 7 Number of AST nodes: 7
1
TimeZone zone = TimeZone.getTimeZone("GMT");
1
TimeZone zone = TimeZone.getTimeZone("GMT");
2
        Hour h1 = new Hour(new Date(1014307199999L), zone);
2
        Second s1 = new Second(new Date(1016729758999L), zone);
3
        Hour h2 = new Hour(new Date(1014307200000L), zone);
3
        Second s2 = new Second(new Date(1016729759000L), zone);
4
        assertEquals(15, h1.getHour());
4
        assertEquals(58, s1.getSecond());
5
        assertEquals(1014307199999L, h1.getLastMillisecond(zone));
5
        assertEquals(1016729758999L, s1.getLastMillisecond(zone));
6
        assertEquals(16, h2.getHour());
6
        assertEquals(59, s2.getSecond());
7
        assertEquals(1014307200000L, h2.getFirstMillisecond(zone));
7
        assertEquals(1016729759000L, s2.getFirstMillisecond(zone));
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 comparisons28
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    TimeZone zone = TimeZone.getTimeZone("GMT");
    1
    TimeZone zone = TimeZone.getTimeZone("GMT");
    2
    Hour h1 = new Hour(new Date(1014307199999L), zone);
    2
    Hour h1 = new Hour(new Date(1014307199999L), zone);
    2
    Second s1 = new Second(new Date(1016729758999L), zone);
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.Hourorg.jfree.data.time.SecondSUBCLASS_TYPE_MISMATCH
    h1s1VARIABLE_NAME_MISMATCH
    org.jfree.data.time.Hourorg.jfree.data.time.SecondSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.Hourorg.jfree.data.time.SecondSUBCLASS_TYPE_MISMATCH
    1014307199999L1016729758999LLITERAL_VALUE_MISMATCH
    Preondition Violations
    Expression new Hour(new Date(1014307199999L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new Second(new Date(1016729758999L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    Second s1 = new Second(new Date(1016729758999L), zone);
    3
    Hour h2 = new Hour(new Date(1014307200000L), zone);
    3
    Hour h2 = new Hour(new Date(1014307200000L), zone);
    3
    Second s2 = new Second(new Date(1016729759000L), zone);
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.Hourorg.jfree.data.time.SecondSUBCLASS_TYPE_MISMATCH
    h2s2VARIABLE_NAME_MISMATCH
    org.jfree.data.time.Hourorg.jfree.data.time.SecondSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.Hourorg.jfree.data.time.SecondSUBCLASS_TYPE_MISMATCH
    1014307200000L1016729759000LLITERAL_VALUE_MISMATCH
    Preondition Violations
    Expression new Hour(new Date(1014307200000L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new Second(new Date(1016729759000L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    Second s2 = new Second(new Date(1016729759000L), zone);
    4
    assertEquals(15, h1.getHour());
    4
    assertEquals(15, h1.getHour());
    4
    assertEquals(58, s1.getSecond());
    Differences
    Expression1Expression2Difference
    1558LITERAL_VALUE_MISMATCH
    getHourgetSecondMETHOD_INVOCATION_NAME_MISMATCH
    h1s1VARIABLE_NAME_MISMATCH
    org.jfree.data.time.Hourorg.jfree.data.time.SecondSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression h1.getHour() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression s1.getSecond() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression h1 cannot be unified with expression s1 , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public int getHour() , public int getSecond()
    4
    assertEquals(58, s1.getSecond());
    5
    assertEquals(1014307199999L, h1.getLastMillisecond(zone));
    5
    assertEquals(1014307199999L, h1.getLastMillisecond(zone));
    5
    assertEquals(1016729758999L, s1.getLastMillisecond(zone));
    Differences
    Expression1Expression2Difference
    1014307199999L1016729758999LLITERAL_VALUE_MISMATCH
    h1s1VARIABLE_NAME_MISMATCH
    org.jfree.data.time.Hourorg.jfree.data.time.SecondSUBCLASS_TYPE_MISMATCH
    5
    assertEquals(1016729758999L, s1.getLastMillisecond(zone));
    6
    assertEquals(16, h2.getHour());
    6
    assertEquals(16, h2.getHour());
    6
    assertEquals(59, s2.getSecond());
    Differences
    Expression1Expression2Difference
    1659LITERAL_VALUE_MISMATCH
    getHourgetSecondMETHOD_INVOCATION_NAME_MISMATCH
    h2s2VARIABLE_NAME_MISMATCH
    org.jfree.data.time.Hourorg.jfree.data.time.SecondSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression h2.getHour() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression s2.getSecond() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression h2 cannot be unified with expression s2 , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public int getHour() , public int getSecond()
    6
    assertEquals(59, s2.getSecond());
    7
    assertEquals(1014307200000L, h2.getFirstMillisecond(zone));
    7
    assertEquals(1014307200000L, h2.getFirstMillisecond(zone));
    7
    assertEquals(1016729759000L, s2.getFirstMillisecond(zone));
    Differences
    Expression1Expression2Difference
    1014307200000L1016729759000LLITERAL_VALUE_MISMATCH
    h2s2VARIABLE_NAME_MISMATCH
    org.jfree.data.time.Hourorg.jfree.data.time.SecondSUBCLASS_TYPE_MISMATCH
    7
    assertEquals(1016729759000L, s2.getFirstMillisecond(zone));
    Precondition Violations (10)
    Row Violation
    1Expression new Hour(new Date(1014307199999L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new Second(new Date(1016729758999L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression new Hour(new Date(1014307200000L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression new Second(new Date(1016729759000L),zone) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression h1.getHour() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression s1.getSecond() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression h1 cannot be unified with expression s1 , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public int getHour() , public int getSecond()
    8Expression h2.getHour() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression s2.getSecond() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression h2 cannot be unified with expression s2 , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public int getHour() , public int getSecond()