Configuration cfg = new Configuration(); assertNotNull( cfg.getEventListeners().getDeleteEventListeners() ); try { cfg.setListener( null, new DeleteListenerForTest() ); fail( "should have thrown MappingException" ); } catch ( MappingException ex ) { // expected }
Configuration cfg = new Configuration(); assertNotNull( cfg.getEventListeners().getDeleteEventListeners() ); try { cfg.setListener( "unknown-type", new DeleteListenerForTest() ); fail( "should have thrown MappingException" ); } catch ( MappingException ex ) { // expected }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/cfg/ListenerTest.java File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/cfg/ListenerTest.java
Method name: void testSetListenerNullType() Method name: void testSetListenerUnknownType()
Number of AST nodes: 5 Number of AST nodes: 5
1
Configuration cfg = new Configuration();
1
Configuration cfg = new Configuration();
2
		assertNotNull( cfg.getEventListeners().getDeleteEventListeners() );
2
		assertNotNull( cfg.getEventListeners().getDeleteEventListeners() );
3
		try {
3
		try {
4
			cfg.setListener( null, new DeleteListenerForTest() );
4
			cfg.setListener( "unknown-type", new DeleteListenerForTest() );
5
			fail( "should have thrown MappingException" );
5
			fail( "should have thrown MappingException" );
6
		}
6
		}
7
		catch ( MappingException ex ) {
7
		catch ( MappingException ex ) {
8
			// expected
8
			// expected
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.1
Clones locationClones are declared in the same class
Number of node comparisons11
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements5
    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.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Configuration cfg = new Configuration();
    1
    Configuration cfg = new Configuration();
    2
    assertNotNull(cfg.getEventListeners().getDeleteEventListeners());
    2
    assertNotNull(cfg.getEventListeners().getDeleteEventListeners());
    3
    try
    3
    try
    4
    cfg.setListener(null, new DeleteListenerForTest());
    4
    cfg.setListener(null, new DeleteListenerForTest());
    4
    cfg.setListener("unknown-type", new DeleteListenerForTest());
    Differences
    Expression1Expression2Difference
    null"unknown-type"TYPE_COMPATIBLE_REPLACEMENT
    4
    cfg.setListener("unknown-type", new DeleteListenerForTest());
    5
    fail("should have thrown MappingException");
    5
    fail("should have thrown MappingException");
    Precondition Violations (0)
    Row Violation