use of javax.transaction.TransactionalException in project crnk-framework by crnk-project.
the class CdiTransactionRunnerTest method testTransactionalExceptionNotToBeUnwrapped.
@Test
public void testTransactionalExceptionNotToBeUnwrapped() throws Exception {
Callable callable = Mockito.mock(Callable.class);
Mockito.when(callable.call()).thenThrow(new TransactionalException("a", new IOException("b")));
try {
runner.doInTransaction(callable);
Assert.fail();
} catch (TransactionalException e) {
Assert.assertEquals("a", e.getMessage());
}
Mockito.verify(callable, Mockito.times(1)).call();
}
use of javax.transaction.TransactionalException in project narayana by jbosstm.
the class TransactionalImplTest method testNeverExistingTX.
@Test
public void testNeverExistingTX() throws Exception {
TransactionManager tm = Utills.getTransactionManager();
Utills.assertTransactionActive(false);
tm.begin();
Utills.assertTransactionActive(true);
try {
testTransactionalBean.invokeWithNever();
Assert.fail("Expected Exception to be thrown, but it was not");
} catch (TransactionalException e) {
// expected
}
Utills.assertTransactionActive(true);
tm.commit();
Utills.assertTransactionActive(false);
}
Aggregations