EntityTransactionImpl implements EntityTransaction { @Override public void begin() { if (isActive()) { throw new IllegalStateException("Transaction already active!"); } wrapper.begin(); this.active = true; wrapper.getEntityManager().transactionStarted(this); LOG.trace("EntityTransaction begin."); } EntityTransactionImpl(EntityTransactionWrapper wrapper); @Override void begin(); @Override void commit(); @Override void rollback(); @Override void setRollbackOnly(); @Override boolean isRollbackOnly(); @Override boolean isActive();  }
@Test public void testBegin() { assertFalse(transaction.isActive()); transaction.begin(); assertTrue(transaction.isActive()); verify(emMock).transactionStarted(transaction); }