Transaction { public void commit() { verifyActive(); this.state = PARTIALLY_COMMITTED; }  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 testCommit() { transaction.begin(); transaction.commit(); assertEquals(TransactionState.PARTIALLY_COMMITTED, transaction.getState()); }
@Test void commitUninitializedIsIllegal() { assertThrows(IllegalStateException.class, () -> transaction.commit()); }