@Test public void whenCommitted_thenIgnore() { Transaction tx = new AbstractTransactionImpl(clock); tx.commit(); long version = clock.getVersion(); tx.commit(); assertIsCommitted(tx); assertEquals(version, clock.getVersion()); }
@Test public void whenAborted_thenDeadTransactionException() { Transaction tx = new AbstractTransactionImpl(clock); tx.abort(); long version = clock.getVersion(); try { tx.commit(); fail(); } catch (DeadTransactionException ex) { } assertIsAborted(tx); assertEquals(version, clock.getVersion()); }