testf.includePattern(PATTERNS); for (int idx = 0; idx < TESTDATA.length; idx++) { TestData td = TESTDATA[idx]; String theFile = td.file; boolean expect = td.inclpatt; assertEquals(!expect, testf.isFiltered(theFile,null)); String line = testf.filter(theFile); if (line != null) { assertTrue("Expect to accept " + theFile, expect); } else { assertFalse("Expect to reject " + theFile, expect); } }
testf.excludePattern(PATTERNS); for (int idx = 0; idx < TESTDATA.length; idx++) { TestData td = TESTDATA[idx]; String theFile = td.file; boolean expect = td.exclpatt; assertEquals(!expect, testf.isFiltered(theFile,null)); String line = testf.filter(theFile); if (line != null) { assertTrue("Expect to accept " + theFile, expect); } else { assertFalse("Expect to reject " + theFile, expect); } }
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/util/accesslog/TestLogFilter.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/protocol/http/util/accesslog/TestLogFilter.java
Method name: void testIncludePattern() Method name: void testExcludePattern()
Number of AST nodes: 10 Number of AST nodes: 10
1
testf.includePattern(PATTERNS);
1
testf.excludePattern(PATTERNS);
2
			for (int idx = 0; idx < TESTDATA.length; idx++) {
2
			for (int idx = 0; idx < TESTDATA.length; idx++) {
3
				TestData td = TESTDATA[idx];
3
				TestData td = TESTDATA[idx];
4
				String theFile = td.file;
4
				String theFile = td.file;
5
				boolean expect = td.inclpatt;
5
				boolean expect = td.exclpatt;
6
				assertEquals(!expect, testf.isFiltered(theFile,null));
6
				assertEquals(!expect, testf.isFiltered(theFile,null));
7
				String line = testf.filter(theFile);
7
				String line = testf.filter(theFile);
8
				if (line != null) {
8
				if (line != null) {
9
					assertTrue("Expect to accept " + theFile, expect);
9
					assertTrue("Expect to accept " + theFile, expect);
10
				} else {
10
				} else {
11
					assertFalse("Expect to reject " + theFile, expect);
11
					assertFalse("Expect to reject " + theFile, expect);
12
				}
12
				}
13
			}
13
			}
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 declared in the same class
Number of node comparisons46
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    testf.includePattern(PATTERNS);
    1
    testf.includePattern(PATTERNS);
    1
    testf.excludePattern(PATTERNS);
    Differences
    Expression1Expression2Difference
    includePatternexcludePatternMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression testf.includePattern(PATTERNS) is a void method call, and thus it cannot be parameterized
    Expression testf.excludePattern(PATTERNS) is a void method call, and thus it cannot be parameterized
    1
    testf.excludePattern(PATTERNS);
    2
    for (int idx = 0; idx < TESTDATA.length; idx++)
    2
    for (int idx = 0; idx < TESTDATA.length; idx++)
    3
    TestData td = TESTDATA[idx];
    3
    TestData td = TESTDATA[idx];
    4
    String theFile = td.file;
    4
    String theFile = td.file;
    5
    boolean expect = td.inclpatt;
    5
    boolean expect = td.inclpatt;
    5
    boolean expect = td.exclpatt;
    Differences
    Expression1Expression2Difference
    inclpattexclpattVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression td.inclpatt cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression td.exclpatt cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5
    boolean expect = td.exclpatt;
    6
    assertEquals(!expect, testf.isFiltered(theFile, null));
    6
    assertEquals(!expect, testf.isFiltered(theFile, null));
    7
    String line = testf.filter(theFile);
    7
    String line = testf.filter(theFile);
    8
    if (line != null)
    8
    if (line != null)
    9
    assertTrue("Expect to accept " + theFile, expect);
    9
    assertTrue("Expect to accept " + theFile, expect);
    else
    else
    10
    assertFalse("Expect to reject " + theFile, expect);
    10
    assertFalse("Expect to reject " + theFile, expect);
    Precondition Violations (4)
    Row Violation
    1Expression testf.includePattern(PATTERNS) is a void method call, and thus it cannot be parameterized
    2Expression testf.excludePattern(PATTERNS) is a void method call, and thus it cannot be parameterized
    3Expression td.inclpatt cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression td.exclpatt cannot be parameterized, because it has dependencies to/from statements that will be extracted