Transaction { public void verifyActive() { if (!isActive()) { throw new IllegalStateException("Transaction is not active. Current state is " + state); } }  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 verifyActiveThrowsIllegalStateForInactiveTransaction() { assertThrows(IllegalStateException.class, () -> transaction.verifyActive()); }