EntityTransactionImpl implements EntityTransaction { @Override public void setRollbackOnly() { verifyTransactionActive("setRollbackOnly"); this.rollbackOnly = true; } EntityTransactionImpl(EntityTransactionWrapper wrapper); @Override void begin(); @Override void commit(); @Override void rollback(); @Override void setRollbackOnly(); @Override boolean isRollbackOnly(); @Override boolean isActive();  }
@Test public void testSetRollbackOnly() { transaction.begin(); assertFalse(transaction.isRollbackOnly()); transaction.setRollbackOnly(); assertTrue(transaction.isRollbackOnly()); }
@Test public void testSetRollbackOnlyNotActive() { assertThrows(IllegalStateException.class, () -> transaction.setRollbackOnly()); }