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 ++;
}
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 ++;
}
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("ordering failed", "a".equals(one.getValue()));↵ | | 5 | assertTrue("'a' isn't first element", "a".equals(one.getValue()));↵
|
6 | break;↵ | | 6 | break;↵
|
7 | case 1:↵ | | 7 | case 1:↵
|
8 | assertTrue("ordering failed", "b".equals(one.getValue()));↵ | | 8 | assertTrue("'b' isn't second element", "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 | }
|
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 in the same method |
Number of node comparisons | 64 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 13 |
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) | 22.1 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
37 | while (it.hasNext()) | | 56 | while (it.hasNext()) |
38 | One one = (One)it.next(); | | 57 | One one = (One)it.next(); |
39 | | | 58 | |
40 | | | 59 | |
41 | assertTrue("ordering failed", "a".equals(one.getValue())); | | 60 | assertTrue("'a' isn't first element", "a".equals(one.getValue())); |
42 | | | 61 | |
43 | | | 62 | |
44 | assertTrue("ordering failed", "b".equals(one.getValue())); | | 63 | assertTrue("'b' isn't second element", "b".equals(one.getValue())); |
45 | | | 64 | |
46 | | | 65 | |
47 | assertTrue("more than two elements", false); | | 66 | assertTrue("more than two elements", false); |
48 | | | 67 | |
49 | | | 68 | |
Precondition Violations (0)
Row |
Violation |