public void testProxiedInvocationException() { if ( ! ( Environment.getBytecodeProvider() instanceof org.hibernate.bytecode.cglib.BytecodeProviderImpl ) ) { // because of the scoping :( reportSkip( "env not configured for cglib provider", "bytecode-provider InvocationTargetException handling" ); return; } Session s = openSession(); s.beginTransaction(); Bean bean = new Bean(); bean.setSomeString( "my-bean" ); s.save( bean ); s.getTransaction().commit(); s.close(); s = openSession(); s.beginTransaction(); bean = ( Bean ) s.load( Bean.class, bean.getSomeString() ); assertFalse( Hibernate.isInitialized( bean ) ); try { bean.throwException(); fail( "exception not thrown" ); } catch ( ParseException e ) { // expected behavior } catch( Throwable t ) { fail( "unexpected exception type : " + t ); } s.delete( bean ); s.getTransaction().commit(); s.close();
public void testProxiedInvocationException() { if ( !( Environment.getBytecodeProvider() instanceof org.hibernate.bytecode.javassist.BytecodeProviderImpl ) ) { // because of the scoping :( reportSkip( "env not configured for javassist provider", "bytecode-provider InvocationTargetException handling" ); return; } Session s = openSession(); s.beginTransaction(); Bean bean = new Bean(); bean.setSomeString( "my-bean" ); s.save( bean ); s.getTransaction().commit(); s.close(); s = openSession(); s.beginTransaction(); bean = ( Bean ) s.load( Bean.class, bean.getSomeString() ); assertFalse( Hibernate.isInitialized( bean ) ); try { bean.throwException(); fail( "exception not thrown" ); } catch ( ParseException e ) { // expected behavior } catch ( Throwable t ) { fail( "unexpected exception type : " + t ); } s.delete( bean ); s.getTransaction().commit(); s.close();
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/bytecode/cglib/InvocationTargetExceptionTest.java File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/bytecode/javassist/InvocationTargetExceptionTest.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public void testProxiedInvocationException() {
1
public void testProxiedInvocationException() {
2
		if ( ! ( Environment.getBytecodeProvider() instanceof org.hibernate.bytecode.cglib.BytecodeProviderImpl ) ) {
2
		if ( !( Environment.getBytecodeProvider() instanceof org.hibernate.bytecode.javassist.BytecodeProviderImpl ) ) {
3
			// because of the scoping :(
3
			// because of the scoping :(
4
			reportSkip( 
4
			reportSkip(
5
"env not configured for cglib provider", "bytecode-provider InvocationTargetException handling" 
5
					"env not configured for javassist provider", "bytecode-provider InvocationTargetException handling"
6
);
6
			);
7
			return;
7
			return;
8
		}
8
		}
9
		Session s = openSession();
9
		Session s = openSession();
10
		s.beginTransaction();
10
		s.beginTransaction();
11
		Bean bean = new Bean();
11
		Bean bean = new Bean();
12
		bean.setSomeString( "my-bean" );
12
		bean.setSomeString( "my-bean" );
13
		s.save( bean );
13
		s.save( bean );
14
		s.getTransaction().commit();
14
		s.getTransaction().commit();
15
		s.close();
15
		s.close();
16
		s = openSession();
16
		s = openSession();
17
		s.beginTransaction();
17
		s.beginTransaction();
18
		bean = ( Bean ) s.load( Bean.class, bean.getSomeString() );
18
		bean = ( Bean ) s.load( Bean.class, bean.getSomeString() );
19
		assertFalse( Hibernate.isInitialized( bean ) );
19
		assertFalse( Hibernate.isInitialized( bean ) );
20
		try {
20
		try {
21
			bean.throwException();
21
			bean.throwException();
22
			fail( "exception not thrown" );
22
			fail( "exception not thrown" );
23
		}
23
		}
24
		catch ( ParseException e ) {
24
		catch ( ParseException e ) {
25
			// expected behavior
25
			// expected behavior
26
		}
26
		}
27
		catch( Throwable t ) {
27
		catch ( Throwable t ) {
28
			fail( "unexpected exception type : " + t );
28
			fail( "unexpected exception type : " + t );
29
		}
29
		}
30
		s.delete( bean );
30
		s.delete( bean );
31
		s.getTransaction().commit();
31
		s.getTransaction().commit();
32
		s.close();
32
		s.close();
33
	
33
	
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0