assertEquals("Loop: "+i,"before", nextName(controller)); 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)); } assertEquals("Loop: "+i,"after", nextName(controller)); assertNull("Loop: "+i,nextName(controller));
assertEquals("Loop: "+i,"before", 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)); } assertEquals("Loop: "+i,"after", nextName(controller)); assertNull("Loop: "+i,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: 9 Number of AST nodes: 9
1
assertEquals("Loop: "+i,"before", nextName(controller));
1
assertEquals("Loop: "+i,"before", nextName(controller));
2
				if (i==1) {
2
				if (i==1){
3
					assertEquals("Loop: "+i,"one", nextName(controller));
3
					assertEquals("Loop: "+i,"one", nextName(controller));
4
					assertEquals("Loop: "+i,"two", nextName(controller));
4
					assertEquals("Loop: "+i,"two", nextName(controller));
5
					assertEquals("Loop: "+i,"three", nextName(controller));
5
					
6
					jmvars.put("VAR", "LAST"); // Should not enter the loop next time
6
jmvars.put("VAR", "LAST"); // Should not enter the loop next time
7
					
7
					// But should continue to the end of the loop
8
					assertEquals("Loop: "+i,"three", nextName(controller));
8
assertEquals("Loop: "+i,"four", nextName(controller));
9
					assertEquals("Loop: "+i,"four", nextName(controller));
9
				}
10
				}
10
				assertEquals("Loop: "+i,"after", nextName(controller));
11
				assertEquals("Loop: "+i,"after", nextName(controller));
11
				assertNull("Loop: "+i,nextName(controller));
12
				assertNull("Loop: "+i,nextName(controller));
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.2
Clones locationClones are declared in the same class
Number of node comparisons54
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)104.5
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    34
    assertEquals("Loop: " + i, "before", nextName(controller));
    34
    assertEquals("Loop: " + i, "before", nextName(controller));
    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));
    41
    assertEquals("Loop: " + i, "after", nextName(controller));
    41
    assertEquals("Loop: " + i, "after", nextName(controller));
    42
    assertNull("Loop: " + i, nextName(controller));
    42
    assertNull("Loop: " + i, nextName(controller));
    Precondition Violations (0)
    Row Violation