while ( it.hasNext() ) { One one = (One)it.next(); switch (count) { case 0: assertTrue("'a' isn't first element", "a".equals(one.getValue())); break; case 1: assertTrue("'b' isn't second element", "b".equals(one.getValue())); break; default: assertTrue("more than two elements", false); break; } count ++; }
while ( it.hasNext() ) { One one = (One)it.next(); switch (count) { case 0: assertTrue("ordering failed", "a".equals(one.getValue())); break; case 1: assertTrue("ordering failed", "b".equals(one.getValue())); break; default: assertTrue("more than two elements", false); break; } count ++; }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/legacy/FooBarTest.java File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/legacy/FooBarTest.java
Method name: void testOrderBy() Method name: void testOrderBy()
Number of AST nodes: 13 Number of AST nodes: 13
1
while ( it.hasNext() ) {
1
while ( it.hasNext() ) {
2
			One one = (One)it.next();
2
			One one = (One)it.next();
3
			switch (count) {
3
			switch (count) {
4
				case 0:
4
				case 0:
5
				assertTrue("'a' isn't first element", "a".equals(one.getValue()));
5
				assertTrue("ordering failed", "a".equals(one.getValue()));
6
				break;
6
				break;
7
				case 1:
7
				case 1:
8
				assertTrue("'b' isn't second element", "b".equals(one.getValue()));
8
				assertTrue("ordering failed", "b".equals(one.getValue()));
9
				break;
9
				break;
10
				default:
10
				default:
11
				assertTrue("more than two elements", false);
11
				assertTrue("more than two elements", false);
12
				break;
12
				break;
13
			}
13
			}
14
			count ++;
14
			count ++;
15
		}
15
		}
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 in the same method
Number of node comparisons64
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements13
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)3.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    56
    while (it.hasNext())
    37
    while (it.hasNext())
    57
    One one = (One)it.next();
    38
    One one = (One)it.next();
    58
    switch (count)
    39
    switch (count)
    59
    case 0:
    40
    case 0:
    60
    assertTrue("'a' isn't first element", "a".equals(one.getValue()));
    60
    assertTrue("'a' isn't first element", "a".equals(one.getValue()));
    41
    assertTrue("ordering failed", "a".equals(one.getValue()));
    Differences
    Expression1Expression2Difference
    "'a' isn't first element""ordering failed"LITERAL_VALUE_MISMATCH
    41
    assertTrue("ordering failed", "a".equals(one.getValue()));
    61
    break;
    42
    break;
    62
    case 1:
    43
    case 1:
    63
    assertTrue("'b' isn't second element", "b".equals(one.getValue()));
    63
    assertTrue("'b' isn't second element", "b".equals(one.getValue()));
    44
    assertTrue("ordering failed", "b".equals(one.getValue()));
    Differences
    Expression1Expression2Difference
    "'b' isn't second element""ordering failed"LITERAL_VALUE_MISMATCH
    44
    assertTrue("ordering failed", "b".equals(one.getValue()));
    64
    break;
    45
    break;
    65
    default:
    46
    default:
    66
    assertTrue("more than two elements", false);
    47
    assertTrue("more than two elements", false);
    67
    break;
    48
    break;
    68
    count++;
    49
    count++;
    Precondition Violations (0)
    Row Violation