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()); } public void testParseExample6() throws Exception { StringProperty prop = new StringProperty("html", "${server}"); JMeterProperty newProp = transformer.transformValue(prop); newProp.setRunningVersion(true); assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName()); assertEquals("jakarta.apache.org", newProp.getStringValue()); } public void testParseExample5() throws Exception { StringProperty prop = new StringProperty("html", ""); JMeterProperty newProp = transformer.transformValue(prop); newProp.setRunningVersion(true); assertEquals("org.apache.jmeter.testelement.property.StringProperty", newProp.getClass().getName()); assertEquals("", newProp.getStringValue()); } public void testParseExample7() throws Exception { StringProperty prop = new StringProperty("html", "${__regexFunction(\\<([a-z]*)\\>,$1$)}"); JMeterProperty newProp = transformer.transformValue(prop); newProp.setRunningVersion(true); assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName()); assertEquals("html", newProp.getStringValue()); } public void testParseExample8() 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 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()); }
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()); } public void testParseExample6() throws Exception { StringProperty prop = new StringProperty("html", "${server}"); JMeterProperty newProp = transformer.transformValue(prop); newProp.setRunningVersion(true); assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName()); assertEquals("jakarta.apache.org", newProp.getStringValue()); } public void testParseExample5() throws Exception { StringProperty prop = new StringProperty("html", ""); JMeterProperty newProp = transformer.transformValue(prop); newProp.setRunningVersion(true); assertEquals("org.apache.jmeter.testelement.property.StringProperty", newProp.getClass().getName()); assertEquals("", newProp.getStringValue()); } public void testParseExample7() throws Exception { StringProperty prop = new StringProperty("html", "${__regexFunction(\\<([a-z]*)\\>,$1$)}"); JMeterProperty newProp = transformer.transformValue(prop); newProp.setRunningVersion(true); assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName()); assertEquals("html", newProp.getStringValue()); } public void testParseExample8() 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 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 {
2
		StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(.*)</html>,$1$)}");
3
		JMeterProperty newProp = transformer.transformValue(prop);
4
		newProp.setRunningVersion(true);
5
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
6
		assertEquals("hello world", newProp.getStringValue());
7
	}
8
	public void testParseExample2() throws Exception {
9
		StringProperty prop = new StringProperty("html", "It should say:\\${${__regexFunction(<html>(.*)</html>,$1$)}}");
10
		JMeterProperty newProp = transformer.transformValue(prop);
11
		newProp.setRunningVersion(true);
12
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
13
		assertEquals("It should say:${hello world}", newProp.getStringValue());
14
	}
15
	public void testParseExample3() throws Exception {
16
		StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(.*)</html>,$1$)}"
17
				+ "${__regexFunction(<html>(.*o)(.*o)(.*)</html>," + "$1$$3$)}");
18
		JMeterProperty newProp = transformer.transformValue(prop);
19
		newProp.setRunningVersion(true);
20
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
21
		assertEquals("hello worldhellorld", newProp.getStringValue());
22
	}
23
	public void testParseExample4() throws Exception {
1
void testParseExample4() throws Exception {
24
		StringProperty prop = new StringProperty("html", "${non-existing function}");
2
		StringProperty prop = new StringProperty("html", "${non-existing function}");
25
		JMeterProperty newProp = transformer.transformValue(prop);
3
		JMeterProperty newProp = transformer.transformValue(prop);
26
		newProp.setRunningVersion(true);
4
		newProp.setRunningVersion(true);
27
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
5
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
28
		assertEquals("${non-existing function}", newProp.getStringValue());
6
		assertEquals("${non-existing function}", newProp.getStringValue());
29
	}
7
	}
30
	public void testParseExample6() throws Exception {
8
	public void testParseExample6() throws Exception {
31
		StringProperty prop = new StringProperty("html", "${server}");
9
		StringProperty prop = new StringProperty("html", "${server}");
32
		JMeterProperty newProp = transformer.transformValue(prop);
10
		JMeterProperty newProp = transformer.transformValue(prop);
33
		newProp.setRunningVersion(true);
11
		newProp.setRunningVersion(true);
34
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
12
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
35
		assertEquals("jakarta.apache.org", newProp.getStringValue());
13
		assertEquals("jakarta.apache.org", newProp.getStringValue());
36
	}
14
	}
37
	public void testParseExample5() throws Exception {
15
	public void testParseExample5() throws Exception {
38
		StringProperty prop = new StringProperty("html", "");
16
		StringProperty prop = new StringProperty("html", "");
39
		JMeterProperty newProp = transformer.transformValue(prop);
17
		JMeterProperty newProp = transformer.transformValue(prop);
40
		newProp.setRunningVersion(true);
18
		newProp.setRunningVersion(true);
41
		assertEquals("org.apache.jmeter.testelement.property.StringProperty", newProp.getClass().getName());
19
		assertEquals("org.apache.jmeter.testelement.property.StringProperty", newProp.getClass().getName());
42
		assertEquals("", newProp.getStringValue());
20
		assertEquals("", newProp.getStringValue());
43
	}
21
	}
44
	public void testParseExample7() throws Exception {
22
	public void testParseExample7() throws Exception {
45
		StringProperty prop = new StringProperty("html", "${__regexFunction(\\<([a-z]*)\\>,$1$)}");
23
		StringProperty prop = new StringProperty("html", "${__regexFunction(\\<([a-z]*)\\>,$1$)}");
46
		JMeterProperty newProp = transformer.transformValue(prop);
24
		JMeterProperty newProp = transformer.transformValue(prop);
47
		newProp.setRunningVersion(true);
25
		newProp.setRunningVersion(true);
48
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
26
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
49
		assertEquals("html", newProp.getStringValue());
27
		assertEquals("html", newProp.getStringValue());
50
	}
28
	}
51
	public void testParseExample8() throws Exception {
29
	public void testParseExample8() throws Exception {
52
		StringProperty prop = new StringProperty("html", "${__regexFunction((\\\\$\\d+\\.\\d+),$1$)}");
30
		StringProperty prop = new StringProperty("html", "${__regexFunction((\\\\$\\d+\\.\\d+),$1$)}");
53
		JMeterProperty newProp = transformer.transformValue(prop);
31
		JMeterProperty newProp = transformer.transformValue(prop);
54
		newProp.setRunningVersion(true);
32
		newProp.setRunningVersion(true);
55
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
33
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
56
		assertEquals("$3.47", newProp.getStringValue());
34
		assertEquals("$3.47", newProp.getStringValue());
57
	}
35
	}
58
	public void testParseExample9() throws Exception {
36
	public void testParseExample9() throws Exception {
59
		StringProperty prop = new StringProperty("html", "${__regexFunction(([$]\\d+\\.\\d+),$1$)}");
37
		StringProperty prop = new StringProperty("html", "${__regexFunction(([$]\\d+\\.\\d+),$1$)}");
60
		JMeterProperty newProp = transformer.transformValue(prop);
38
		JMeterProperty newProp = transformer.transformValue(prop);
61
		newProp.setRunningVersion(true);
39
		newProp.setRunningVersion(true);
62
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
40
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
63
		assertEquals("$3.47", newProp.getStringValue());
41
		assertEquals("$3.47", newProp.getStringValue());
64
	}
42
	}
43
	public void testParseExample10() throws Exception {
44
		StringProperty prop = new StringProperty("html", "${__regexFunction(\\ "
45
				+ "(\\\\\\$\\d+\\.\\d+\\,\\\\$\\d+\\.\\d+),$1$)}");
46
		JMeterProperty newProp = transformer.transformValue(prop);
47
		newProp.setRunningVersion(true);
48
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
49
		assertEquals("$3.47,$5.67", newProp.getStringValue());
50
	}
51
	public void testNestedExample1() throws Exception {
52
		StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(${my_regex})</html>,"
53
				+ "$1$)}${__regexFunction(<html>(.*o)(.*o)(.*)" + "</html>,$1$$3$)}");
54
		JMeterProperty newProp = transformer.transformValue(prop);
55
		newProp.setRunningVersion(true);
56
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
57
		assertEquals("hello worldhellorld", newProp.getStringValue());
58
	}
59
	public void testNestedExample2() throws Exception {
60
		StringProperty prop = new StringProperty("html", "${__regexFunction(<html>(${my_regex})</html>,$1$)}");
61
		JMeterProperty newProp = transformer.transformValue(prop);
62
		newProp.setRunningVersion(true);
63
		assertEquals("org.apache.jmeter.testelement.property.FunctionProperty", newProp.getClass().getName());
64
		assertEquals("hello world", newProp.getStringValue());
65
	}
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