XOTransactionImpl implements XOTransaction { @Override public void rollback() { try { datastoreTransaction.rollback(); } finally { afterCompletion(false); rollbackOnly = false; } } XOTransactionImpl(DatastoreTransaction datastoreTransaction); @Override XOTransaction begin(); @Override void commit(); @Override void rollback(); @Override boolean isActive(); @Override void setRollbackOnly(); @Override boolean isRollbackOnly(); @Override void registerSynchronization(Synchronization synchronization); @Override void unregisterSynchronization(Synchronization synchronization); void registerDefaultSynchronization(Synchronization synchronization); @Override void close();  }
@Test public void rollback() { XOTransaction xoTransaction = new XOTransactionImpl(datastoreTransaction); xoTransaction.begin(); assertThat(xoTransaction.isActive(), equalTo(true)); xoTransaction.rollback(); assertThat(xoTransaction.isActive(), equalTo(false)); verify(datastoreTransaction).begin(); verify(datastoreTransaction, never()).commit(); verify(datastoreTransaction).rollback(); verify(datastoreTransaction, times(2)).isActive(); }