Transaction { public void begin() { if (state != null && state != ABORTED && state != COMMITTED) { throw new IllegalStateException("Cannot begin transaction. Current state is " + state); } this.state = ACTIVE; }  void begin(); void commit(); void afterCommit(); void rollback(); void afterRollback(); boolean isActive(); TransactionState getState(); void verifyActive(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test void testBegin() { transaction.begin(); assertTrue(transaction.isActive()); assertEquals(TransactionState.ACTIVE, transaction.getState()); }