if (i==1) {
assertEquals("Loop: "+i,"one", nextName(controller));
assertEquals("Loop: "+i,"two", nextName(controller));
assertEquals("Loop: "+i,"three", nextName(controller));
jmvars.put("VAR", "LAST"); // Should not enter the loop next time
assertEquals("Loop: "+i,"four", nextName(controller));
}
if (i==1){
assertEquals("Loop: "+i,"one", nextName(controller));
assertEquals("Loop: "+i,"two", nextName(controller));
jmvars.put("VAR", "LAST"); // Should not enter the loop next time
// But should continue to the end of the loop
assertEquals("Loop: "+i,"three", nextName(controller));
assertEquals("Loop: "+i,"four", nextName(controller));
}
Clone fragments detected by clone detection tool
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/control/TestWhileController.java
|
|
File path: /jakarta-jmeter-2.3.2/test/src/org/apache/jmeter/control/TestWhileController.java
|
Method name: void testVariable1()
|
|
Method name: void testVariable2()
|
Number of AST nodes: 6
|
|
Number of AST nodes: 6
|
|
1 | if (i==1) {↵ | | 1 | if (i==1){↵
|
2 | assertEquals("Loop: "+i,"one", nextName(controller));↵ | | 2 | assertEquals("Loop: "+i,"one", nextName(controller));↵
|
3 | assertEquals("Loop: "+i,"two", nextName(controller));↵ | | 3 | assertEquals("Loop: "+i,"two", nextName(controller));↵
|
4 | assertEquals("Loop: "+i,"three", nextName(controller));↵ | | 4 | ↵
|
5 | jmvars.put("VAR", "LAST"); // Should not enter the loop next time↵ | | 5 | jmvars.put("VAR", "LAST"); // Should not enter the loop next time↵
|
6 | ↵ | | 6 | // But should continue to the end of the loop↵
|
| | | 7 | assertEquals("Loop: "+i,"three", nextName(controller));↵
|
7 | assertEquals("Loop: "+i,"four", nextName(controller));↵ | | 8 | assertEquals("Loop: "+i,"four", nextName(controller));↵
|
8 | } | | 9 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 37 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 67.1 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
35 | if (i == 1) | | 35 | if (i == 1) |
36 | assertEquals("Loop: " + i, "one", nextName(controller)); | | 36 | assertEquals("Loop: " + i, "one", nextName(controller)); |
37 | assertEquals("Loop: " + i, "two", nextName(controller)); | | 37 | assertEquals("Loop: " + i, "two", nextName(controller)); |
38 | assertEquals("Loop: " + i, "three", nextName(controller)); | | 39 | assertEquals("Loop: " + i, "three", nextName(controller)); |
39 | jmvars.put("VAR", "LAST"); | | 38 | jmvars.put("VAR", "LAST"); |
40 | assertEquals("Loop: " + i, "four", nextName(controller)); | | 40 | assertEquals("Loop: " + i, "four", nextName(controller)); |
Precondition Violations (0)
Row |
Violation |