final Session session1 = (Session) session1Control.getMock();
MockControl session2Control = MockControl.createControl(Session.class);
final Session session2 = (Session) session2Control.getMock();
MockControl uow1Control = MockControl.createControl(UnitOfWork.class);
UnitOfWork uow1 = (UnitOfWork) uow1Control.getMock();
MockControl uow2Control = MockControl.createControl(UnitOfWork.class);
UnitOfWork uow2 = (UnitOfWork) uow2Control.getMock();
final MockSessionFactory sf = new MockSessionFactory(session1);
session2.getActiveUnitOfWork();
session2Control.setReturnValue(uow2, 2);
uow2.beginEarlyTransaction();
uow2Control.setVoidCallable(1);
uow2.commit();
uow2Control.setVoidCallable();
session2.release();
session2Control.setVoidCallable();
session1.getActiveUnitOfWork();