StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(.*)</html>,$1$)}"); JMeterProperty newProp = transformer.transformValue(prop); newProp.setRunningVersion(true); assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName()); assertEquals("hello world", newProp.getStringValue());
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());
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 testParseExample1() Method name: void testParseExample2()
Number of AST nodes: 5 Number of AST nodes: 5
1
StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(.*)</html>,$1$)}");
1
StringProperty prop = new StringProperty("html", "It should say:\\${${__regexFunction(<html>(.*)</html>,$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("hello world", newProp.getStringValue());
5
		assertEquals("It should say:${hello world}", 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 comparisons11
  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", "${__regexFunction(<html>(.*)</html>,$1$)}");
    1
    StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(.*)</html>,$1$)}");
    1
    StringProperty prop = new StringProperty("html", "It should say:\\${${__regexFunction(<html>(.*)</html>,$1$)}}");
    Differences
    Expression1Expression2Difference
    "${__regexFunction((.*),$1$)}""It should say:\\${${__regexFunction((.*),$1$)}}"LITERAL_VALUE_MISMATCH
    1
    StringProperty prop = new StringProperty("html", "It should say:\\${${__regexFunction(<html>(.*)</html>,$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("hello world", newProp.getStringValue());
    5
    assertEquals("hello world", newProp.getStringValue());
    5
    assertEquals("It should say:${hello world}", newProp.getStringValue());
    Differences
    Expression1Expression2Difference
    "hello world""It should say:${hello world}"LITERAL_VALUE_MISMATCH
    5
    assertEquals("It should say:${hello world}", newProp.getStringValue());
    Precondition Violations (0)
    Row Violation