try { s.isSelected(basedir,filenames[0],files[0]); fail("SizeSelector did not check for value being in the " + "allowable range"); } catch (BuildException be2) { assertEquals("The value attribute is required, and must " + "be positive", be2.getMessage()); } s = (SizeSelector)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/SizeSelectorTest.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("SizeSelector did not check for value being in the "
3
            fail("DepthSelector did not check for maximum being higher "
4
                    + "allowable range");
4
                    + "than minimum");
5
        } catch (BuildException be2) {
5
        } catch (BuildException be2) {
6
            assertEquals("The value attribute is required, and must "
6
            assertEquals("The maximum depth is lower than the minimum.",
7
                    + "be positive", be2.getMessage());
7
                    be2.getMessage());
8
        }
8
        }
9
        s = (SizeSelector)getInstance();
9
        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.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    7
    try
    7
    try
    8
    try
    Differences
    Expression1Expression2Difference
    "The value attribute is required, and must " + "be positive""The maximum depth is lower than the minimum."TYPE_COMPATIBLE_REPLACEMENT
    8
    try
    8
    s.isSelected(basedir, filenames[0], files[0]);
    8
    s.isSelected(basedir, filenames[0], files[0]);
    9
    s.isSelected(basedir, filenames[0], files[0]);
    Differences
    Expression1Expression2Difference
    org.apache.tools.ant.types.selectors.SizeSelectororg.apache.tools.ant.types.selectors.DepthSelectorSUBCLASS_TYPE_MISMATCH
    9
    s.isSelected(basedir, filenames[0], files[0]);
    9
    fail("SizeSelector did not check for value being in the " + "allowable range");
    9
    fail("SizeSelector did not check for value being in the " + "allowable range");
    10
    fail("DepthSelector did not check for maximum being higher " + "than minimum");
    Differences
    Expression1Expression2Difference
    "SizeSelector did not check for value being in the ""DepthSelector did not check for maximum being higher "LITERAL_VALUE_MISMATCH
    "allowable range""than minimum"LITERAL_VALUE_MISMATCH
    10
    fail("DepthSelector did not check for maximum being higher " + "than minimum");
    10
    s = (SizeSelector)getInstance();
    10
    s = (SizeSelector)getInstance();
    11
    s = (DepthSelector)getInstance();
    Differences
    Expression1Expression2Difference
    org.apache.tools.ant.types.selectors.SizeSelectororg.apache.tools.ant.types.selectors.DepthSelectorSUBCLASS_TYPE_MISMATCH
    org.apache.tools.ant.types.selectors.SizeSelectororg.apache.tools.ant.types.selectors.DepthSelectorSUBCLASS_TYPE_MISMATCH
    11
    s = (DepthSelector)getInstance();
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variable s with type org.apache.tools.ant.types.selectors.SizeSelector , while Clone fragment #2 returns variable s with type org.apache.tools.ant.types.selectors.DepthSelector