while ( itr.hasNext() ) { // find john final Person p = ( Person ) itr.next(); if ( p.getName().equals( "John Doe" ) ) { Employee john = ( Employee ) p; assertEquals( "Incorrect fecthed minions count", 1, john.getMinions().size() ); break; } }
while ( itr.hasNext() ) { // find john final Person p = ( Person ) itr.next(); if ( p.getName().equals( "John Doe" ) ) { Employee john = ( Employee ) p; assertEquals( "Incorrect fecthed minions count", 2, john.getMinions().size() ); break; } }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/subclassfilter/UnionSubclassFilterTest.java File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/subclassfilter/JoinedSubclassFilterTest.java
Method name: void testFiltersWithUnionSubclass() Method name: void testFiltersWithJoinedSubclass()
Number of AST nodes: 6 Number of AST nodes: 6
1
while ( itr.hasNext() ) {
1
while ( itr.hasNext() ) {
2
			// find john
2
			// find john
3
			final Person p = ( Person ) itr.next();
3
			final Person p = ( Person ) itr.next();
4
			if ( p.getName().equals( "John Doe" ) ) {
4
			if ( p.getName().equals( "John Doe" ) ) {
5
				Employee john = ( Employee ) p;
5
				Employee john = ( Employee ) p;
6
				assertEquals( "Incorrect fecthed minions count", 1, john.getMinions().size() );
6
				assertEquals( "Incorrect fecthed minions count", 2, john.getMinions().size() );
7
				break;
7
				break;
8
			}
8
			}
9
		}
9
		}
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 different classes having the same super class
Number of node comparisons20
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    27
    while (itr.hasNext())
    32
    while (itr.hasNext())
    28
    final Person p = (Person)itr.next();
    33
    final Person p = (Person)itr.next();
    29
    if (p.getName().equals("John Doe"))
    34
    if (p.getName().equals("John Doe"))
    30
    Employee john = (Employee)p;
    35
    Employee john = (Employee)p;
    31
    assertEquals("Incorrect fecthed minions count", 1, john.getMinions().size());
    31
    assertEquals("Incorrect fecthed minions count", 1, john.getMinions().size());
    36
    assertEquals("Incorrect fecthed minions count", 2, john.getMinions().size());
    Differences
    Expression1Expression2Difference
    12LITERAL_VALUE_MISMATCH
    36
    assertEquals("Incorrect fecthed minions count", 2, john.getMinions().size());
    32
    break;
    37
    break;
    Precondition Violations (0)
    Row Violation