* @param canCommit true if the bean does not use the client transaction.
* @throws Exception if an error during the tests occurs.
*/
public void testUsingClientTransWithRuntimeException(final Class expectedException, final boolean canCommit)
throws Exception {
UserTransaction utx = ExceptionHandleUtil.getUserTransaction();
utx.begin();
// verifies if the exception thrown is correct
try {
sfsbContainerTransactionRuntime.insertCorrectFirstErrorSecond(DATABASE_1, DATABASE_2);
} catch (Exception e) {
assertTrue(ExceptionHelper.isEquals(e, expectedException),
"The container did not throw the correct exception, the expected exception is "
+ expectedException.getName() + ", but the container threw " + e.getClass().getName());
}
// tries to commit
try {
utx.commit();
if (!canCommit) {
fail("The transaction was marked as rolled back, the client cannot make the commit.");
}
} catch (Exception e) {
logger.debug("The bean threw an expected error during the execution {0}", e);