StringProperty prop = new StringProperty("html", "It should say:\\${${__regexFunction(<html>(.*)</html>,$1$)}}"); JMeterProperty newProp = transformer.transformValue(prop); newProp.setRunningVersion(true); assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName()); assertEquals("It should say:${hello world}", newProp.getStringValue());
StringProperty prop = new StringProperty("html", "${__regexFunction((\\\\$\\d+\\.\\d+),$1$)}"); JMeterProperty newProp = transformer.transformValue(prop); newProp.setRunningVersion(true); assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName()); assertEquals("$3.47", newProp.getStringValue());
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/engine/util/PackageTest.java File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/engine/util/PackageTest.java
Method name: void testParseExample2() Method name: void testParseExample8()
Number of AST nodes: 5 Number of AST nodes: 5
1
StringProperty prop = new StringProperty("html", "It should say:\\${${__regexFunction(<html>(.*)</html>,$1$)}}");
1
StringProperty prop = new StringProperty("html", "${__regexFunction((\\\\$\\d+\\.\\d+),$1$)}");
2
		JMeterProperty newProp = transformer.transformValue(prop);
2
		JMeterProperty newProp = transformer.transformValue(prop);
3
		newProp.setRunningVersion(true);
3
		newProp.setRunningVersion(true);
4
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
4
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
5
		assertEquals("It should say:${hello world}", newProp.getStringValue());
5
		assertEquals("$3.47", newProp.getStringValue());
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 comparisons14
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements5
    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
    StringProperty prop = new StringProperty("html", "It should say:\\${${__regexFunction(<html>(.*)</html>,$1$)}}");
    1
    StringProperty prop = new StringProperty("html", "It should say:\\${${__regexFunction(<html>(.*)</html>,$1$)}}");
    1
    StringProperty prop = new StringProperty("html", "${__regexFunction((\\\\$\\d+\\.\\d+),$1$)}");
    Differences
    Expression1Expression2Difference
    "It should say:\\${${__regexFunction((.*),$1$)}}""${__regexFunction((\\\\$\\d+\\.\\d+),$1$)}"LITERAL_VALUE_MISMATCH
    1
    StringProperty prop = new StringProperty("html", "${__regexFunction((\\\\$\\d+\\.\\d+),$1$)}");
    2
    JMeterProperty newProp = transformer.transformValue(prop);
    2
    JMeterProperty newProp = transformer.transformValue(prop);
    3
    newProp.setRunningVersion(true);
    3
    newProp.setRunningVersion(true);
    4
    assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
    4
    assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
    5
    assertEquals("It should say:${hello world}", newProp.getStringValue());
    5
    assertEquals("It should say:${hello world}", newProp.getStringValue());
    5
    assertEquals("$3.47", newProp.getStringValue());
    Differences
    Expression1Expression2Difference
    "It should say:${hello world}""$3.47"LITERAL_VALUE_MISMATCH
    5
    assertEquals("$3.47", newProp.getStringValue());
    Precondition Violations (0)
    Row Violation