tm.registerSynchronization(sync);
tm.setRollbackOnly();
final XATerminator xaTerminator = new XATerminatorImple();
try {
xaTerminator.commit(xid, true);
tm.doOnePhaseCommit();
fail("did not get expected rollback exception");
} catch(XAException e) {
assertEquals("javax.transaction.RollbackException", e.getCause().getClass().getName());
assertEquals(XAException.XA_RBROLLBACK, e.errorCode);
// expected - we tried to commit a rollbackonly tx.