public void testPutResourceForExceptionTx() { tsr.putResource("hoge", "foo"); try { tsr.putResource(null, "foo"); fail(); } catch (NullPointerException ignore) { } }
/** @throws Exception */ public void testGetRollbackOnlyForException() throws Exception { try { tsr.getRollbackOnly(); fail(); } catch (IllegalStateException ignore) { } }
/** @throws Exception */ public void testGetResourceForException() throws Exception { try { tsr.getResource("hoge"); fail(); } catch (IllegalStateException ignore) { } }
public void testPutResourceForException() { try { tsr.putResource("hoge", "foo"); fail(); } catch (IllegalStateException ignore) { } }
/** @throws Exception */ public void testRegisterInterposedSynchronization() throws Exception { Sync.result = new StringBuffer(); tm.begin(); tsr.registerInterposedSynchronization(new Sync('a', 'b')); tsr.registerInterposedSynchronization(new Sync('c', 'd')); tm.getTransaction().registerSynchronization(new Sync('e', 'f')); tm.commit(); assertEquals("eacbdf", Sync.result.toString()); }
/** @throws Exception */ public void testRegisterInterposedSynchronizationForException() throws Exception { try { tsr.registerInterposedSynchronization( new Synchronization() { public void beforeCompletion() {} public void afterCompletion(int arg0) {} }); fail(); } catch (IllegalStateException ignore) { } }
/** @throws Exception */ public void testGetRollbackOnlyTx() throws Exception { assertFalse(tsr.getRollbackOnly()); tsr.setRollbackOnly(); assertTrue(tsr.getRollbackOnly()); }
/** @throws Exception */ public void testSetRollbackOnlyTx() throws Exception { tsr.setRollbackOnly(); assertEquals(Status.STATUS_MARKED_ROLLBACK, tsr.getTransactionStatus()); }
/** @throws Exception */ public void testGetResourceTx() throws Exception { assertNull(tsr.getResource("hoge")); tsr.putResource("hoge", "foo"); assertEquals("foo", tsr.getResource("hoge")); }
/** @throws Exception */ public void testGetTransactionKeyTx() throws Exception { assertNotNull(tsr.getTransactionKey()); }