public void testTransactionRollback() throws Exception {
MockControl sfControl = MockControl.createControl(SessionFactory.class);
final SessionFactory sf = (SessionFactory) sfControl.getMock();
MockControl sessionControl = MockControl.createControl(XASession.class);
final XASession session = (XASession) sessionControl.getMock();
// create nice mock
MockControl xaResControl = MockControl.createControl(XAResource.class);
XAResource xaRes = (XAResource) xaResControl.getMock();
sfControl.expectAndReturn(sf.getSession(), session);
sessionControl.expectAndReturn(session.getXAResource(), xaRes);
session.save();
session.logout();
/*
* // used for ServiceProvider MockControl repositoryControl =
* MockControl.createNiceControl(Repository.class); Repository
* repository = (Repository) repositoryControl.getMock();
* repositoryControl.replay();