public void testUnitOfWorkRolledBackOnCommitFailure_ErrorOnDispatchEvents() {
UnitOfWorkListener mockListener = mock(UnitOfWorkListener.class);
when(mockListener.onEventRegistered(isA(UnitOfWork.class), Matchers.<EventMessage<Object>>any()))
.thenAnswer(new ReturnParameterAnswer(1));
doThrow(new MockException()).when(mockEventBus).publish(isA(EventMessage.class));
testSubject.start();
testSubject.registerListener(mockListener);
testSubject.publishEvent(new GenericEventMessage<Object>(new Object()), mockEventBus);
try {
testSubject.commit();