Configuration cfg = new Configuration(); try { cfg.addResource( getBaseForMappings() + "extendshbm/packageentitynames.hbm.xml" ); cfg.buildMappings(); assertNotNull( cfg.getClassMapping( "EntityHasName" ) ); assertNotNull( cfg.getClassMapping( "EntityCompany" ) ); } catch ( HibernateException e ) { e.printStackTrace(); fail( "should not fail with exception! " + e ); }
Configuration cfg = new Configuration(); try { cfg.addResource( getBaseForMappings() + "extendshbm/unionsubclass.hbm.xml" ); cfg.buildMappings(); assertNotNull( cfg.getClassMapping( "org.hibernate.test.extendshbm.Person" ) ); assertNotNull( cfg.getClassMapping( "org.hibernate.test.extendshbm.Customer" ) ); } catch ( HibernateException e ) { e.printStackTrace(); fail( "should not fail with exception! " + e ); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/extendshbm/ExtendsTest.java File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/extendshbm/ExtendsTest.java
Method name: void testEntityNamesWithPackage() Method name: void testUnionSubclass()
Number of AST nodes: 6 Number of AST nodes: 6
1
Configuration cfg = new Configuration();
1
Configuration cfg = new Configuration();
2
		try {
2
		try {
3
			cfg.addResource( getBaseForMappings() + "extendshbm/packageentitynames.hbm.xml" );
3
			cfg.addResource( getBaseForMappings() + "extendshbm/unionsubclass.hbm.xml" );
4
			cfg.buildMappings();
4
			cfg.buildMappings();
5
			assertNotNull( cfg.getClassMapping( "EntityHasName" ) );
5
			assertNotNull( cfg.getClassMapping( "org.hibernate.test.extendshbm.Person" ) );
6
			assertNotNull( cfg.getClassMapping( "EntityCompany" ) );
6
			assertNotNull( cfg.getClassMapping( "org.hibernate.test.extendshbm.Customer" ) );
7
		}
7
		}
8
		catch ( HibernateException e ) {
8
		catch ( HibernateException e ) {
9
			e.printStackTrace();
9
			e.printStackTrace();
10
			fail( "should not fail with exception! " + e );
10
			fail( "should not fail with exception! " + e );
11
		}
11
		}
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 comparisons26
  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)1.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Configuration cfg = new Configuration();
    1
    Configuration cfg = new Configuration();
    2
    try
    2
    try
    3
    cfg.addResource(getBaseForMappings() + "extendshbm/packageentitynames.hbm.xml");
    3
    cfg.addResource(getBaseForMappings() + "extendshbm/packageentitynames.hbm.xml");
    3
    cfg.addResource(getBaseForMappings() + "extendshbm/unionsubclass.hbm.xml");
    Differences
    Expression1Expression2Difference
    "extendshbm/packageentitynames.hbm.xml""extendshbm/unionsubclass.hbm.xml"LITERAL_VALUE_MISMATCH
    3
    cfg.addResource(getBaseForMappings() + "extendshbm/unionsubclass.hbm.xml");
    4
    cfg.buildMappings();
    4
    cfg.buildMappings();
    5
    assertNotNull(cfg.getClassMapping("EntityHasName"));
    5
    assertNotNull(cfg.getClassMapping("EntityHasName"));
    5
    assertNotNull(cfg.getClassMapping("org.hibernate.test.extendshbm.Person"));
    Differences
    Expression1Expression2Difference
    "EntityHasName""org.hibernate.test.extendshbm.Person"LITERAL_VALUE_MISMATCH
    5
    assertNotNull(cfg.getClassMapping("org.hibernate.test.extendshbm.Person"));
    6
    assertNotNull(cfg.getClassMapping("EntityCompany"));
    6
    assertNotNull(cfg.getClassMapping("EntityCompany"));
    6
    assertNotNull(cfg.getClassMapping("org.hibernate.test.extendshbm.Customer"));
    Differences
    Expression1Expression2Difference
    "EntityCompany""org.hibernate.test.extendshbm.Customer"LITERAL_VALUE_MISMATCH
    6
    assertNotNull(cfg.getClassMapping("org.hibernate.test.extendshbm.Customer"));
    Precondition Violations (0)
    Row Violation