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();
try { s.isSelected(basedir,filenames[0],files[0]); fail("DepthSelector did not check for required fields"); } catch (BuildException be1) { assertEquals("You must set at least one of the min or the " + "max levels.", be1.getMessage()); } s = (DepthSelector)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/DepthSelectorTest.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 Datetime being in a "
3
            fail("DepthSelector did not check for 
4
                    + "valid format");
4
required fields");
5
        } catch (BuildException be3) {
5
        } catch (BuildException be1) {
6
            assertEquals("Date of this is not a date"
6
            assertEquals("
7
                        + " Cannot be parsed correctly. It should be in"
8
                        + " MM/DD/YYYY HH:MM AM_PM format
7
You must set at least one of the min or the " +
9
.", be3.getMessage());
8
                    "max levels.", be1.getMessage());
10
        }
9
        }
11
        s = (DateSelector)getInstance();
10
        s = (DepthSelector)getInstance();
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)11.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    12
    try
    12
    try
    2
    try
    Differences
    Expression1Expression2Difference
    be3be1VARIABLE_NAME_MISMATCH
    "Date of this is not a date""You must set at least one of the min or the "LITERAL_VALUE_MISMATCH
    " Cannot be parsed correctly. It should be in""max levels."LITERAL_VALUE_MISMATCH
    "Date of this is not a date" + " Cannot be parsed correctly. It should be in" + " MM/DD/YYYY HH:MM AM_PM format.""You must set at least one of the min or the " + "max levels."INFIX_EXTENDED_OPERAND_NUMBER_MISMATCH
    be3be1VARIABLE_NAME_MISMATCH
    2
    try
    13
    s.isSelected(basedir, filenames[0], files[0]);
    13
    s.isSelected(basedir, filenames[0], files[0]);
    3
    s.isSelected(basedir, filenames[0], files[0]);
    Differences
    Expression1Expression2Difference
    org.apache.tools.ant.types.selectors.DateSelectororg.apache.tools.ant.types.selectors.DepthSelectorSUBCLASS_TYPE_MISMATCH
    3
    s.isSelected(basedir, 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");
    4
    fail("DepthSelector did not check for required fields");
    Differences
    Expression1Expression2Difference
    "DateSelector did not check for Datetime being in a " + "valid format""DepthSelector did not check for required fields"TYPE_COMPATIBLE_REPLACEMENT
    4
    fail("DepthSelector did not check for required fields");
    15
    s = (DateSelector)getInstance();
    15
    s = (DateSelector)getInstance();
    5
    s = (DepthSelector)getInstance();
    Differences
    Expression1Expression2Difference
    org.apache.tools.ant.types.selectors.DateSelectororg.apache.tools.ant.types.selectors.DepthSelectorSUBCLASS_TYPE_MISMATCH
    org.apache.tools.ant.types.selectors.DateSelectororg.apache.tools.ant.types.selectors.DepthSelectorSUBCLASS_TYPE_MISMATCH
    5
    s = (DepthSelector)getInstance();
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variable s with type org.apache.tools.ant.types.selectors.DateSelector , while Clone fragment #2 returns variable s with type org.apache.tools.ant.types.selectors.DepthSelector