void testParseExample1() throws Exception { 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()); } public void testParseExample2() throws Exception { 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()); } public void testParseExample3() throws Exception { StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(.*)</html>,$1$)}" + "${__regexFunction(<html>(.*o)(.*o)(.*)</html>," + "$1$$3$)}"); JMeterProperty newProp = transformer.transformValue(prop); newProp.setRunningVersion(true); assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName()); assertEquals("hello worldhellorld", newProp.getStringValue()); }
void testParseExample10() throws Exception { StringProperty prop = new StringProperty("html", "${__regexFunction(\\ " + "(\\\\\\$\\d+\\.\\d+\\,\\\\$\\d+\\.\\d+),$1$)}"); JMeterProperty newProp = transformer.transformValue(prop); newProp.setRunningVersion(true); assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName()); assertEquals("$3.47,$5.67", newProp.getStringValue()); } public void testNestedExample1() throws Exception { StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(${my_regex})</html>," + "$1$)}${__regexFunction(<html>(.*o)(.*o)(.*)" + "</html>,$1$$3$)}"); JMeterProperty newProp = transformer.transformValue(prop); newProp.setRunningVersion(true); assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName()); assertEquals("hello worldhellorld", newProp.getStringValue()); } public void testNestedExample2() throws Exception { StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(${my_regex})</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()); }
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: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
void testParseExample1() throws Exception {
1
void testParseExample10() throws Exception {
2
		StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(.*)</html>
2
		StringProperty prop = new StringProperty("html", "${__regexFunction(\\ "
3
,$1$)}");
3
				+ "(\\\\\\$\\d+\\.\\d+\\,\\\\$\\d+\\.\\d+),$1$)}");
4
		JMeterProperty newProp = transformer.transformValue(prop);
4
		JMeterProperty newProp = transformer.transformValue(prop);
5
		newProp.setRunningVersion(true);
5
		newProp.setRunningVersion(true);
6
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
6
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
7
		assertEquals("hello world", newProp.getStringValue());
7
		assertEquals("$3.47,$5.67", newProp.getStringValue());
8
	}
8
	}
9
	public void testParseExample2() throws Exception {
9
	public void testNestedExample1() throws Exception {
10
		StringProperty prop = new StringProperty("html", "It should say:\\${
10
		StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(${my_regex})</html>,"
11
${__regexFunction(<html>(.*)</html>,$1$)}}");
11
				+ "$1$)}${__regexFunction(<html>(.*o)(.*o)(.*)" + "</html>,$1$$3$)}");
12
		JMeterProperty newProp = transformer.transformValue(prop);
12
		JMeterProperty newProp = transformer.transformValue(prop);
13
		newProp.setRunningVersion(true);
13
		newProp.setRunningVersion(true);
14
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
14
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
15
		assertEquals("It should say:${hello world}", newProp.getStringValue());
15
		assertEquals("hello worldhellorld", newProp.getStringValue());
16
	}
16
	}
17
	public void testParseExample3() throws Exception {
17
	public void testNestedExample2() throws Exception {
18
		StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(.*)</html>,$1$)}"
18
		StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(
19
				+ "${__regexFunction(<html>(.*o)(.*o)(.*)</html>," + "$1$$3$)}");
19
${my_regex})</html>,$1$)}");
20
		JMeterProperty newProp = transformer.transformValue(prop);
20
		JMeterProperty newProp = transformer.transformValue(prop);
21
		newProp.setRunningVersion(true);
21
		newProp.setRunningVersion(true);
22
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
22
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
23
		assertEquals("hello worldhellorld", newProp.getStringValue());
23
		assertEquals("hello world", newProp.getStringValue());
24
	}
24
	}
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0