container.add(mapper3); FileNameMapper fileNameMapper = container.getImplementation(); String[] targets = fileNameMapper.mapFileName("fromfilename"); assertNotNull("no filenames mapped", targets); assertEquals("wrong number of filenames mapped", 3, targets.length); List list = Arrays.asList(targets); assertTrue("cannot find expected target \"tofilename\"", list.contains("tofilename")); assertTrue("cannot find expected target \"fromfilename\"", list.contains("fromfilename"));
chained.addConfiguredMapper(mapperCX); FileNameMapper fileNameMapper = chained.getImplementation(); String[] targets = fileNameMapper.mapFileName("a"); assertNotNull("no filenames mapped", targets); assertEquals("wrong number of filenames mapped", 2, targets.length); List list = Arrays.asList(targets); assertTrue("cannot find expected target \"def\"", list.contains("def")); assertTrue("cannot find expected target \"ghi\"", list.contains("ghi"));
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/MapperTest.java File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/MapperTest.java
Method name: void testNested() Method name: void testChained()
Number of AST nodes: 8 Number of AST nodes: 8
1
container.add(mapper3);
1
chained.addConfiguredMapper(mapperCX);
2
        FileNameMapper fileNameMapper = container.getImplementation();
2
        FileNameMapper fileNameMapper = chained.getImplementation();
3
        String[] targets = fileNameMapper.mapFileName("fromfilename");
3
        String[] targets = fileNameMapper.mapFileName("a");
4
        assertNotNull("no filenames mapped", targets);
4
        assertNotNull("no filenames mapped", targets);
5
        assertEquals("wrong number of filenames mapped", 3, targets.length);
5
        assertEquals("wrong number of filenames mapped", 2, targets.length);
6
        List list = Arrays.asList(targets);
6
        List list = Arrays.asList(targets);
7
        assertTrue("cannot find expected target \"tofilename\"",
7
        assertTrue("cannot find expected target \"
8
            list.contains("tofilename"));
8
def\"", list.contains("def"));
9
        assertTrue("cannot find expected target \"fromfilename\"",
9
        assertTrue("cannot find expected target \"
10
            list.contains("fromfilename"));
10
ghi\"", list.contains("ghi"));
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.0
Clones locationClones are declared in the same class
Number of node comparisons40
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    13
    container.add(mapper3);
    13
    container.add(mapper3);
    26
    assertTrue("cannot find expected target \"def\"", list.contains("def"));
    Differences
    Expression1Expression2Difference
    addassertTrueMETHOD_INVOCATION_NAME_MISMATCH
    container.add(mapper3)assertTrue("cannot find expected target \"def\"",list.contains("def"))ARGUMENT_NUMBER_MISMATCH
    containerMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression assertTrue("cannot find expected target \"def\"",list.contains("def")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression container.add(mapper3) is a void method call, and thus it cannot be parameterized
    Expression assertTrue("cannot find expected target \"def\"",list.contains("def")) is a void method call, and thus it cannot be parameterized
    Expression assertTrue("cannot find expected target \"def\"",list.contains("def")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression container.add(mapper3) is a void method call, and thus it cannot be parameterized
    Expression assertTrue("cannot find expected target \"def\"",list.contains("def")) is a void method call, and thus it cannot be parameterized
    26
    assertTrue("cannot find expected target \"def\"", list.contains("def"));
    14
    FileNameMapper fileNameMapper = container.getImplementation();
    14
    FileNameMapper fileNameMapper = container.getImplementation();
    21
    FileNameMapper fileNameMapper = chained.getImplementation();
    Differences
    Expression1Expression2Difference
    containerchainedVARIABLE_NAME_MISMATCH
    21
    FileNameMapper fileNameMapper = chained.getImplementation();
    15
    String[] targets = fileNameMapper.mapFileName("fromfilename");
    15
    String[] targets = fileNameMapper.mapFileName("fromfilename");
    22
    String[] targets = fileNameMapper.mapFileName("a");
    Differences
    Expression1Expression2Difference
    "fromfilename""a"LITERAL_VALUE_MISMATCH
    22
    String[] targets = fileNameMapper.mapFileName("a");
    16
    assertNotNull("no filenames mapped", targets);
    23
    assertNotNull("no filenames mapped", targets);
    17
    assertEquals("wrong number of filenames mapped", 3, targets.length);
    17
    assertEquals("wrong number of filenames mapped", 3, targets.length);
    24
    assertEquals("wrong number of filenames mapped", 2, targets.length);
    Differences
    Expression1Expression2Difference
    32LITERAL_VALUE_MISMATCH
    24
    assertEquals("wrong number of filenames mapped", 2, targets.length);
    18
    List list = Arrays.asList(targets);
    25
    List list = Arrays.asList(targets);
    19
    assertTrue("cannot find expected target \"tofilename\"", list.contains("tofilename"));
    19
    assertTrue("cannot find expected target \"tofilename\"", list.contains("tofilename"));
    20
    chained.addConfiguredMapper(mapperCX);
    Differences
    Expression1Expression2Difference
    assertTrueaddConfiguredMapperMETHOD_INVOCATION_NAME_MISMATCH
    assertTrue("cannot find expected target \"tofilename\"",list.contains("tofilename"))chained.addConfiguredMapper(mapperCX)ARGUMENT_NUMBER_MISMATCH
    chainedMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression assertTrue("cannot find expected target \"tofilename\"",list.contains("tofilename")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertTrue("cannot find expected target \"tofilename\"",list.contains("tofilename")) is a void method call, and thus it cannot be parameterized
    Expression chained.addConfiguredMapper(mapperCX) is a void method call, and thus it cannot be parameterized
    Expression assertTrue("cannot find expected target \"tofilename\"",list.contains("tofilename")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression assertTrue("cannot find expected target \"tofilename\"",list.contains("tofilename")) is a void method call, and thus it cannot be parameterized
    Expression chained.addConfiguredMapper(mapperCX) is a void method call, and thus it cannot be parameterized
    20
    chained.addConfiguredMapper(mapperCX);
    20
    assertTrue("cannot find expected target \"fromfilename\"", list.contains("fromfilename"));
    20
    assertTrue("cannot find expected target \"fromfilename\"", list.contains("fromfilename"));
    27
    assertTrue("cannot find expected target \"ghi\"", list.contains("ghi"));
    Differences
    Expression1Expression2Difference
    "cannot find expected target \"fromfilename\"""cannot find expected target \"ghi\""LITERAL_VALUE_MISMATCH
    "fromfilename""ghi"LITERAL_VALUE_MISMATCH
    27
    assertTrue("cannot find expected target \"ghi\"", list.contains("ghi"));
    Precondition Violations (13)
    Row Violation
    1Expression assertTrue("cannot find expected target \"def\"",list.contains("def")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression container.add(mapper3) is a void method call, and thus it cannot be parameterized
    3Expression assertTrue("cannot find expected target \"def\"",list.contains("def")) is a void method call, and thus it cannot be parameterized
    4Expression assertTrue("cannot find expected target \"def\"",list.contains("def")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression container.add(mapper3) is a void method call, and thus it cannot be parameterized
    6Expression assertTrue("cannot find expected target \"def\"",list.contains("def")) is a void method call, and thus it cannot be parameterized
    7Expression assertTrue("cannot find expected target \"tofilename\"",list.contains("tofilename")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression assertTrue("cannot find expected target \"tofilename\"",list.contains("tofilename")) is a void method call, and thus it cannot be parameterized
    9Expression chained.addConfiguredMapper(mapperCX) is a void method call, and thus it cannot be parameterized
    10Expression assertTrue("cannot find expected target \"tofilename\"",list.contains("tofilename")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression assertTrue("cannot find expected target \"tofilename\"",list.contains("tofilename")) is a void method call, and thus it cannot be parameterized
    12Expression chained.addConfiguredMapper(mapperCX) is a void method call, and thus it cannot be parameterized
    13Clone fragment #1 returns variables list , while Clone fragment #2 returns variables