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()); } public void testParseExample4() throws Exception { StringProperty prop = new StringProperty("html", "${non-existing function}"); JMeterProperty newProp = transformer.transformValue(prop); newProp.setRunningVersion(true); assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName()); assertEquals("${non-existing function}", newProp.getStringValue()); }
void testParseExample9() throws Exception { 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()); } public 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 testParseExample9() throws Exception {
2
		StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(.*)</html>,$1$)}");
2
		StringProperty prop = new StringProperty("html", "${__regexFunction(([$]\\d+\\.\\d+),$1$)}");
3
		JMeterProperty newProp = transformer.transformValue(prop);
3
		JMeterProperty newProp = transformer.transformValue(prop);
4
		newProp.setRunningVersion(true);
4
		newProp.setRunningVersion(true);
5
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
5
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
6
		assertEquals("hello world", newProp.getStringValue());
6
		assertEquals("$3.47", newProp.getStringValue());
7
	}
7
	}
8
	public void testParseExample2() throws Exception {
8
	public void testParseExample10() throws Exception {
9
		StringProperty prop = new StringProperty("html", "It should say:\\${${__regexFunction(<html>(.*)</html>
9
		StringProperty prop = new StringProperty("html", "${__regexFunction(\\ "
10
,$1$)}}");
10
				+ "(\\\\\\$\\d+\\.\\d+\\,\\\\$\\d+\\.\\d+),$1$)}");
11
		JMeterProperty newProp = transformer.transformValue(prop);
11
		JMeterProperty newProp = transformer.transformValue(prop);
12
		newProp.setRunningVersion(true);
12
		newProp.setRunningVersion(true);
13
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
13
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
14
		assertEquals("It should say:${hello world}", newProp.getStringValue());
14
		assertEquals("$3.47,$5.67", newProp.getStringValue());
15
	}
15
	}
16
	public void testParseExample3() throws Exception {
16
	public void testNestedExample1() throws Exception {
17
		StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(.*)</html>,$1$)}"
17
		StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(${my_regex})</html>,"
18
				+ "${__regexFunction(<html>(.*o)(.*o)(.*)</html>," + "$1$$3$)}");
18
				+ "$1$)}${__regexFunction(<html>(.*o)(.*o)(.*)" + "</html>,$1$$3$)}");
19
		JMeterProperty newProp = transformer.transformValue(prop);
19
		JMeterProperty newProp = transformer.transformValue(prop);
20
		newProp.setRunningVersion(true);
20
		newProp.setRunningVersion(true);
21
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
21
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
22
		assertEquals("hello worldhellorld", newProp.getStringValue());
22
		assertEquals("hello worldhellorld", newProp.getStringValue());
23
	}
23
	}
24
	public void testParseExample4() throws Exception {
24
	public void testNestedExample2() throws Exception {
25
		StringProperty prop = new StringProperty("html", "${non-existing function}");
25
		StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(${my_regex})</html>,$1$)}");
26
		JMeterProperty newProp = transformer.transformValue(prop);
26
		JMeterProperty newProp = transformer.transformValue(prop);
27
		newProp.setRunningVersion(true);
27
		newProp.setRunningVersion(true);
28
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
28
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
29
		assertEquals("${non-existing function}", newProp.getStringValue());
29
		assertEquals("hello world", newProp.getStringValue());
30
	}
30
	}
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