params = new LinkedList(); params.add(new CompoundVariable("<value field=\"(pinposition\\d+)\">(\\d+)</value>")); params.add(new CompoundVariable("$2$")); params.add(new CompoundVariable("2")); variable.setParameters(params); String match = variable.execute(result, null); assertEquals("5", match);
params = new LinkedList(); params.add(new CompoundVariable("<value field=\"(pinposition\\d+)\">(\\d+)</value>")); params.add(new CompoundVariable("_$1$")); params.add(new CompoundVariable("2")); variable.setParameters(params); String match = variable.execute(result, null); assertEquals("_pinposition2", match);
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/functions/TestRegexFunction.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/functions/TestRegexFunction.java
Method name: void testVariableExtraction() Method name: void testVariableExtraction3()
Number of AST nodes: 7 Number of AST nodes: 7
1
params = new LinkedList();
1
params = new LinkedList();
2
			params.add(new CompoundVariable("<value field=\"(pinposition\\d+)\">(\\d+)</value>"));
2
			params.add(new CompoundVariable("<value field=\"(pinposition\\d+)\">(\\d+)</value>"));
3
			params.add(new CompoundVariable("$2$"));
3
			params.add(new CompoundVariable("_$1$"));
4
			params.add(new CompoundVariable("2"));
4
			params.add(new CompoundVariable("2"));
5
			variable.setParameters(params);
5
			variable.setParameters(params);
6
			String match = variable.execute(result, null);
6
			String match = variable.execute(result, null);
7
			assertEquals("5", match);
7
			assertEquals("_pinposition2", match);
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.0
Clones locationClones are declared in the same class
Number of node comparisons37
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements7
    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
    1
    params = new LinkedList();
    1
    params = new LinkedList();
    2
    params.add(new CompoundVariable("<value field=\"(pinposition\\d+)\">(\\d+)</value>"));
    2
    params.add(new CompoundVariable("<value field=\"(pinposition\\d+)\">(\\d+)</value>"));
    3
    params.add(new CompoundVariable("$2$"));
    3
    params.add(new CompoundVariable("$2$"));
    3
    params.add(new CompoundVariable("_$1$"));
    Differences
    Expression1Expression2Difference
    "$2$""_$1$"LITERAL_VALUE_MISMATCH
    3
    params.add(new CompoundVariable("_$1$"));
    4
    params.add(new CompoundVariable("2"));
    4
    params.add(new CompoundVariable("2"));
    5
    variable.setParameters(params);
    5
    variable.setParameters(params);
    6
    String match = variable.execute(result, null);
    6
    String match = variable.execute(result, null);
    7
    assertEquals("5", match);
    7
    assertEquals("5", match);
    7
    assertEquals("_pinposition2", match);
    Differences
    Expression1Expression2Difference
    "5""_pinposition2"LITERAL_VALUE_MISMATCH
    7
    assertEquals("_pinposition2", match);
    Precondition Violations (0)
    Row Violation