s.setDatetime("this is not a date"); try { s.isSelected(basedir,filenames[0],files[0]); fail("DateSelector did not check for Datetime being in a " + "valid format"); } catch (BuildException be3) { assertEquals("Date of this is not a date" + " Cannot be parsed correctly. It should be in" + " MM/DD/YYYY HH:MM AM_PM format.", be3.getMessage()); }
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()); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/selectors/DateSelectorTest.java File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/selectors/BaseSelectorTest.java
Method name: void testValidate() Method name: void testRespondsToError()
Number of AST nodes: 4 Number of AST nodes: 4
1
s.setDatetime("this is not a date");
1
s.setError("test error");
2
        try {
2
        try {
3
            s.isSelected(basedir,filenames[0],files[0]);
3
            s.isSelected(beddir,filenames[0],files[0]);
4
            fail("DateSelector did not check for Datetime being in a "
4
            fail("
5
                    + "valid format");
5
Cannot cause BuildException when setError() is called");
6
        } catch (BuildException be3) {
6
        } catch (BuildException be) {
7
            assertEquals("Date of this is not a date"
7
            assertEquals("
8
                        + " Cannot be parsed correctly. It should be in"
9
                        + " MM/DD/YYYY HH:MM AM_PM format.",
8
test error",
10
 be3.getMessage());
9
                         be.getMessage());
11
        }
10
        }
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.2
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)1.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    11
    s.setDatetime("this is not a date");
    11
    s.setDatetime("this is not a date");
    4
    s.setError("test error");
    Differences
    Expression1Expression2Difference
    setDatetimesetErrorMETHOD_INVOCATION_NAME_MISMATCH
    "this is not a date""test error"LITERAL_VALUE_MISMATCH
    org.apache.tools.ant.types.selectors.DateSelectororg.apache.tools.ant.types.selectors.BaseSelectorSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression s.setDatetime("this is not a date") is a void method call, and thus it cannot be parameterized
    Expression s.setError("test error") is a void method call, and thus it cannot be parameterized
    4
    s.setError("test error");
    12
    try
    12
    try
    5
    try
    Differences
    Expression1Expression2Difference
    be3beVARIABLE_NAME_MISMATCH
    "Date of this is not a date" + " Cannot be parsed correctly. It should be in" + " MM/DD/YYYY HH:MM AM_PM format.""test error"TYPE_COMPATIBLE_REPLACEMENT
    be3beVARIABLE_NAME_MISMATCH
    5
    try
    13
    s.isSelected(basedir, filenames[0], files[0]);
    13
    s.isSelected(basedir, filenames[0], files[0]);
    6
    s.isSelected(beddir, filenames[0], files[0]);
    Differences
    Expression1Expression2Difference
    basedirbeddirVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.types.selectors.DateSelectororg.apache.tools.ant.types.selectors.BaseSelectorSUBCLASS_TYPE_MISMATCH
    6
    s.isSelected(beddir, filenames[0], files[0]);
    14
    fail("DateSelector did not check for Datetime being in a " + "valid format");
    14
    fail("DateSelector did not check for Datetime being in a " + "valid format");
    7
    fail("Cannot cause BuildException when setError() is called");
    Differences
    Expression1Expression2Difference
    "DateSelector did not check for Datetime being in a " + "valid format""Cannot cause BuildException when setError() is called"TYPE_COMPATIBLE_REPLACEMENT
    7
    fail("Cannot cause BuildException when setError() is called");
    Precondition Violations (2)
    Row Violation
    1Expression s.setDatetime("this is not a date") is a void method call, and thus it cannot be parameterized
    2Expression s.setError("test error") is a void method call, and thus it cannot be parameterized