try { s.isSelected(basedir,filenames[0],files[0]); fail("DateSelector did not check for required fields"); } catch (BuildException be1) { assertEquals("You must provide a datetime or the number of " + "milliseconds.", be1.getMessage()); } s = (DateSelector)getInstance();
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 = (DateSelector)getInstance();
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/DateSelectorTest.java
Method name: void testValidate() Method name: void testValidate()
Number of AST nodes: 4 Number of AST nodes: 4
1
try {
1
try {
2
            s.isSelected(basedir,filenames[0],files[0]);
2
            s.isSelected(basedir,filenames[0],files[0]);
3
            fail("DateSelector did not check for required fields
3
            fail("DateSelector did not check for Datetime being in a "
4
");
4
                    + "valid format");
5
        } catch (BuildException be1) {
5
        } catch (BuildException be3) {
6
            assertEquals("You must provide a datetime or the number of "
6
            assertEquals("
7
                    + "milliseconds
7
Date of this is not a date"
8
                        + " Cannot be parsed correctly. It should be in"
8
.", be1.getMessage());
9
                        + " MM/DD/YYYY HH:MM AM_PM format.", be3.getMessage());
9
        }
10
        }
10
        s = (DateSelector)getInstance();
11
        s = (DateSelector)getInstance();
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 in the same method
Number of node comparisons10
  1. {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)8.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    try
    2
    try
    12
    try
    Differences
    Expression1Expression2Difference
    be1be3VARIABLE_NAME_MISMATCH
    "You must provide a datetime or the number of ""Date of this is not a date"LITERAL_VALUE_MISMATCH
    "milliseconds."" Cannot be parsed correctly. It should be in"LITERAL_VALUE_MISMATCH
    "You must provide a datetime or the number of " + "milliseconds.""Date of this is not a date" + " Cannot be parsed correctly. It should be in" + " MM/DD/YYYY HH:MM AM_PM format."INFIX_EXTENDED_OPERAND_NUMBER_MISMATCH
    be1be3VARIABLE_NAME_MISMATCH
    12
    try
    3
    s.isSelected(basedir, filenames[0], files[0]);
    13
    s.isSelected(basedir, filenames[0], files[0]);
    4
    fail("DateSelector did not check for required fields");
    4
    fail("DateSelector did not check for required fields");
    14
    fail("DateSelector did not check for Datetime being in a " + "valid format");
    Differences
    Expression1Expression2Difference
    "DateSelector did not check for required fields""DateSelector did not check for Datetime being in a " + "valid format"TYPE_COMPATIBLE_REPLACEMENT
    14
    fail("DateSelector did not check for Datetime being in a " + "valid format");
    5
    s = (DateSelector)getInstance();
    15
    s = (DateSelector)getInstance();
    Precondition Violations (0)
    Row Violation