HHH-14503 - Migration of tests from jpa/test to orm/test/jpa

This commit is contained in:
Andrea Boriero 2021-05-03 18:12:54 +02:00
parent 28d7f48019
commit 8936034d29
4 changed files with 13 additions and 11 deletions

View File

@ -124,7 +124,7 @@ public class SynchronizationTypeTest {
assertFalse( entityManager.isOpen() );
assertFalse( session.isOpen() );
}
catch (Throwable t) {
catch (Exception | AssertionError e) {
try {
switch ( transactionManager.getStatus() ) {
case Status.STATUS_ACTIVE:
@ -135,6 +135,7 @@ public class SynchronizationTypeTest {
catch (Exception exception) {
//ignore exception
}
throw e;
}
finally {
if ( entityManager != null && entityManager.isOpen() ) {

View File

@ -72,7 +72,7 @@ public class TransactionJoinHandlingChecker {
assertFalse( entityManager.isOpen() );
assertFalse( session.isOpen() );
}
catch (Throwable t){
catch (Exception | AssertionError e){
try {
switch ( transactionManager.getStatus() ) {
case Status.STATUS_ACTIVE:
@ -83,7 +83,7 @@ public class TransactionJoinHandlingChecker {
catch (Exception exception) {
//ignore exception
}
throw t;
throw e;
}
}
}

View File

@ -87,7 +87,7 @@ public class TransactionRollbackTest {
entityManager.getTransaction().commit();
}
catch (Throwable t) {
catch (Exception | AssertionError e) {
if ( entityManager.getTransaction().isActive() ) {
entityManager.getTransaction().rollback();
}

View File

@ -30,12 +30,11 @@ import org.hibernate.testing.orm.junit.EntityManagerFactoryScope;
import org.hibernate.testing.orm.junit.Jpa;
import org.hibernate.testing.orm.junit.RequiresDialectFeature;
import org.hibernate.testing.orm.junit.Setting;
import org.junit.jupiter.api.Test;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNot.not;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertFalse;
/**
@ -92,7 +91,7 @@ public class JtaWithStatementsBatchTest extends AbstractJtaBatchTest {
assertStatementsListIsCleared();
assertAllStatementsAreClosed( testBatch.createdStatements );
}
catch (Throwable t) {
catch (Exception | AssertionError e) {
try {
switch ( transactionManager.getStatus() ) {
case Status.STATUS_ACTIVE:
@ -100,10 +99,10 @@ public class JtaWithStatementsBatchTest extends AbstractJtaBatchTest {
transactionManager.rollback();
}
}
catch (Exception e) {
catch (Exception exception) {
//ignore e
}
throw new RuntimeException( t );
throw new RuntimeException( e );
}
assertFalse(
@ -132,7 +131,8 @@ public class JtaWithStatementsBatchTest extends AbstractJtaBatchTest {
case Status.STATUS_MARKED_ROLLBACK:
transactionManager.rollback();
}
}catch (Exception e2){
}
catch (Exception e2) {
//ignore e
}
}
@ -143,7 +143,8 @@ public class JtaWithStatementsBatchTest extends AbstractJtaBatchTest {
case Status.STATUS_MARKED_ROLLBACK:
transactionManager.rollback();
}
}catch (Exception e){
}
catch (Exception e) {
//ignore e
}
}