try { s.isSelected(basedir,filenames[0],files[0]); fail("DepthSelector accepted bad minimum as parameter"); } catch (BuildException be4) { assertEquals("Invalid minimum value garbage out", be4.getMessage()); } s = (DepthSelector)getInstance();
try { s.isSelected(basedir,filenames[0],files[0]); fail("DepthSelector did not check for maximum being higher " + "than minimum"); } catch (BuildException be2) { assertEquals("The maximum depth is lower than the minimum.", be2.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/DepthSelectorTest.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("DepthSelector accepted bad minimum as parameter
3
            fail("DepthSelector did not check for maximum being higher "
4
");
4
                    + "than minimum");
5
        } catch (BuildException be4) {
5
        } catch (BuildException be2) {
6
            assertEquals("Invalid minimum value garbage out",
6
            assertEquals("The maximum depth is lower than the minimum.",
7
                    be4.getMessage());
7
                    be2.getMessage());
8
        }
8
        }
9
        s = (DepthSelector)getInstance();
9
        s = (DepthSelector)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
    27
    try
    27
    try
    8
    try
    Differences
    Expression1Expression2Difference
    be4be2VARIABLE_NAME_MISMATCH
    "Invalid minimum value garbage out""The maximum depth is lower than the minimum."LITERAL_VALUE_MISMATCH
    be4be2VARIABLE_NAME_MISMATCH
    8
    try
    28
    s.isSelected(basedir, filenames[0], files[0]);
    9
    s.isSelected(basedir, filenames[0], files[0]);
    29
    fail("DepthSelector accepted bad minimum as parameter");
    29
    fail("DepthSelector accepted bad minimum as parameter");
    10
    fail("DepthSelector did not check for maximum being higher " + "than minimum");
    Differences
    Expression1Expression2Difference
    "DepthSelector accepted bad minimum as parameter""DepthSelector did not check for maximum being higher " + "than minimum"TYPE_COMPATIBLE_REPLACEMENT
    10
    fail("DepthSelector did not check for maximum being higher " + "than minimum");
    30
    s = (DepthSelector)getInstance();
    11
    s = (DepthSelector)getInstance();
    Precondition Violations (0)
    Row Violation