mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-03-03 00:09:19 +00:00
HHH-13936 Add additional test
This commit is contained in:
parent
0ec324540e
commit
3672d5a295
@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.cfg.AvailableSettings;
|
import org.hibernate.cfg.AvailableSettings;
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
@ -20,6 +19,8 @@
|
|||||||
import org.hibernate.testing.jta.TestingJtaPlatformImpl;
|
import org.hibernate.testing.jta.TestingJtaPlatformImpl;
|
||||||
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
|
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
|
||||||
|
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Michiel Hendriks
|
* @author Michiel Hendriks
|
||||||
*/
|
*/
|
||||||
@ -42,7 +43,7 @@ public void testFlush() throws Exception {
|
|||||||
TestingJtaPlatformImpl.INSTANCE.getTransactionManager().commit();
|
TestingJtaPlatformImpl.INSTANCE.getTransactionManager().commit();
|
||||||
}
|
}
|
||||||
catch (TransactionRequiredException e) {
|
catch (TransactionRequiredException e) {
|
||||||
Assert.fail("No TransactionRequiredException expected.");
|
fail("No TransactionRequiredException expected.");
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
session.close();
|
session.close();
|
||||||
@ -59,7 +60,23 @@ public void testIsConnectedFlush() throws Exception {
|
|||||||
TestingJtaPlatformImpl.INSTANCE.getTransactionManager().commit();
|
TestingJtaPlatformImpl.INSTANCE.getTransactionManager().commit();
|
||||||
}
|
}
|
||||||
catch (TransactionRequiredException e) {
|
catch (TransactionRequiredException e) {
|
||||||
Assert.fail("No TransactionRequiredException expected.");
|
fail("No TransactionRequiredException expected.");
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
session.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIsConnectedFlushShouldThrowExceptionIfNoTransaction() {
|
||||||
|
Session session = openSession();
|
||||||
|
try {
|
||||||
|
session.isConnected();
|
||||||
|
session.flush();
|
||||||
|
fail("A TransactionRequiredException should be thrown");
|
||||||
|
}
|
||||||
|
catch (TransactionRequiredException e) {
|
||||||
|
//expected
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
session.close();
|
session.close();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user