Fix NonNullableCircularDependencyCascadeTest

This commit is contained in:
Andrea Boriero 2016-04-29 18:24:21 +01:00 committed by Steve Ebersole
parent bedb33decf
commit 1e6a601795
1 changed files with 6 additions and 2 deletions

View File

@ -10,11 +10,14 @@ import java.util.HashSet;
import org.junit.Test; import org.junit.Test;
import org.hibernate.HibernateException;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.Transaction; import org.hibernate.Transaction;
import org.hibernate.TransientPropertyValueException;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import static org.hamcrest.core.IsInstanceOf.instanceOf;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
/** /**
@ -39,8 +42,9 @@ public class NonNullableCircularDependencyCascadeTest extends BaseCoreFunctional
s.flush(); s.flush();
fail( "should have failed because of transient entities have non-nullable, circular dependency." ); fail( "should have failed because of transient entities have non-nullable, circular dependency." );
} }
catch ( HibernateException ex) { catch (IllegalStateException ex) {
// expected // expected
assertThat( ex.getCause(), instanceOf( TransientPropertyValueException.class ) );
} }
tx.rollback(); tx.rollback();
s.close(); s.close();