if (! hasRegex("testFilterContainsRegex")) return; String contents = getFileString( "filtercontainsregex", "result/filtercontainsregex"); assertStringContains(contents, "hello world"); assertStringNotContains(contents, "this is the moon"); assertStringContains(contents, "World here");
if (! hasRegex("testContainsRegex")) return; String contents = getFileString( "containsregex", "result/containsregex"); assertStringContains(contents, "hello world"); assertStringNotContains(contents, "this is the moon"); assertStringContains(contents, "World here");
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/filters/TokenFilterTest.java File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/filters/TokenFilterTest.java
Method name: void testFilterContainsRegex() Method name: void testContainsRegex()
Number of AST nodes: 6 Number of AST nodes: 6
1
if (! hasRegex("testFilterContainsRegex"))
1
if (! hasRegex("testContainsRegex"))
2
            return;
2
            return;
3
        String contents = getFileString(
3
        String contents = getFileString(
4
            "filtercontainsregex", "result/filtercontainsregex");
4
            "containsregex", "result/containsregex");
5
        assertStringContains(contents, "hello world");
5
        assertStringContains(contents, "hello world");
6
        assertStringNotContains(contents, "this is the moon");
6
        assertStringNotContains(contents, "this is the moon");
7
        assertStringContains(contents, "World here");
7
        assertStringContains(contents, "World here");
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.1
Clones locationClones are declared in the same class
Number of node comparisons20
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (!hasRegex("testFilterContainsRegex"))
    1
    if (!hasRegex("testFilterContainsRegex"))
    1
    if (!hasRegex("testContainsRegex"))
    Differences
    Expression1Expression2Difference
    "testFilterContainsRegex""testContainsRegex"LITERAL_VALUE_MISMATCH
    1
    if (!hasRegex("testContainsRegex"))
    2
    return;
    2
    return;
    3
    String contents = getFileString("filtercontainsregex", "result/filtercontainsregex");
    3
    String contents = getFileString("filtercontainsregex", "result/filtercontainsregex");
    3
    String contents = getFileString("containsregex", "result/containsregex");
    Differences
    Expression1Expression2Difference
    "filtercontainsregex""containsregex"LITERAL_VALUE_MISMATCH
    "result/filtercontainsregex""result/containsregex"LITERAL_VALUE_MISMATCH
    3
    String contents = getFileString("containsregex", "result/containsregex");
    4
    assertStringContains(contents, "hello world");
    4
    assertStringContains(contents, "hello world");
    5
    assertStringNotContains(contents, "this is the moon");
    5
    assertStringNotContains(contents, "this is the moon");
    6
    assertStringContains(contents, "World here");
    6
    assertStringContains(contents, "World here");
    Precondition Violations (0)
    Row Violation