s.setError("test error"); try { s.isSelected(beddir,filenames[0],files[0]); fail("Cannot cause BuildException when setError() is called"); } catch (BuildException be) { assertEquals("test error", be.getMessage()); }
s.setDatetime("01/01/1969 01:01 AM"); try { s.isSelected(basedir,filenames[0],files[0]); fail("DateSelector did not check for Datetime being in the " + "allowable range"); } catch (BuildException be2) { assertEquals("Date of 01/01/1969 01:01 AM results in negative " + "milliseconds value relative to epoch (January 1, " + "1970, 00:00:00 GMT).", be2.getMessage()); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorTest.java File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/selectors/DateSelectorTest.java
Method name: void testRespondsToError() Method name: void testValidate()
Number of AST nodes: 4 Number of AST nodes: 4
1
s.setError("test error");
1
s.setDatetime("01/01/1969 01:01 AM");
2
        try {
2
        try {
3
            s.isSelected(beddir,filenames[0],files[0]);
3
            s.isSelected(basedir,filenames[0],files[0]);
4
            fail("Cannot cause BuildException when setError() is called
4
            fail("DateSelector did not check for Datetime being in the "
5
");
5
                    + "allowable range");
6
        } catch (BuildException be) {
6
        } catch (BuildException be2) {
7
            assertEquals("test error",
7
            assertEquals("
8
                        
8
Date of 01/01/1969 01:01 AM results in negative "
9
                    + "milliseconds value relative to epoch (January 1, "
9
 be.getMessage());
10
                    + "1970, 00:00:00 GMT).", be2.getMessage());
10
        }
11
        }
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.3
Clones locationClones are in different classes having the same super class
Number of node comparisons10
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)18.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    s.setError("test error");
    4
    s.setError("test error");
    6
    s.setDatetime("01/01/1969 01:01 AM");
    Differences
    Expression1Expression2Difference
    "test error""01/01/1969 01:01 AM"LITERAL_VALUE_MISMATCH
    setErrorsetDatetimeMETHOD_INVOCATION_NAME_MISMATCH
    org.apache.tools.ant.types.selectors.BaseSelectororg.apache.tools.ant.types.selectors.DateSelectorSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression s.setError("test error") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression s.setDatetime("01/01/1969 01:01 AM") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression s.setError("test error") is a void method call, and thus it cannot be parameterized
    Expression s.setDatetime("01/01/1969 01:01 AM") is a void method call, and thus it cannot be parameterized
    Expression s cannot be unified with expression s , because common superclass org.apache.tools.ant.types.selectors.BaseSelector does not declare member(s) public void setDatetime(java.lang.String)
    6
    s.setDatetime("01/01/1969 01:01 AM");
    5
    try
    5
    try
    7
    try
    Differences
    Expression1Expression2Difference
    bebe2VARIABLE_NAME_MISMATCH
    "test error""Date of 01/01/1969 01:01 AM results in negative " + "milliseconds value relative to epoch (January 1, " + "1970, 00:00:00 GMT)."TYPE_COMPATIBLE_REPLACEMENT
    bebe2VARIABLE_NAME_MISMATCH
    7
    try
    6
    s.isSelected(beddir, filenames[0], files[0]);
    6
    s.isSelected(beddir, filenames[0], files[0]);
    8
    s.isSelected(basedir, filenames[0], files[0]);
    Differences
    Expression1Expression2Difference
    beddirbasedirVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.types.selectors.BaseSelectororg.apache.tools.ant.types.selectors.DateSelectorSUBCLASS_TYPE_MISMATCH
    8
    s.isSelected(basedir, filenames[0], files[0]);
    7
    fail("Cannot cause BuildException when setError() is called");
    7
    fail("Cannot cause BuildException when setError() is called");
    9
    fail("DateSelector did not check for Datetime being in the " + "allowable range");
    Differences
    Expression1Expression2Difference
    "Cannot cause BuildException when setError() is called""DateSelector did not check for Datetime being in the " + "allowable range"TYPE_COMPATIBLE_REPLACEMENT
    9
    fail("DateSelector did not check for Datetime being in the " + "allowable range");
    Precondition Violations (5)
    Row Violation
    1Expression s.setError("test error") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression s.setDatetime("01/01/1969 01:01 AM") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression s.setError("test error") is a void method call, and thus it cannot be parameterized
    4Expression s.setDatetime("01/01/1969 01:01 AM") is a void method call, and thus it cannot be parameterized
    5Expression s cannot be unified with expression s , because common superclass org.apache.tools.ant.types.selectors.BaseSelector does not declare member(s) public void setDatetime(java.lang.String)