testSubject.subscribe(StubCommand.class.getName(), stubHandler);
testSubject.subscribe(CreateCommand.class.getName(), stubHandler);
testSubject.subscribe(ErrorCommand.class.getName(), stubHandler);
stubHandler.setRepository(testSubject
.createRepository(new GenericAggregateFactory<StubAggregate>(StubAggregate.class)));
final UnitOfWorkListener mockUnitOfWorkListener = mock(UnitOfWorkListener.class);
when(mockUnitOfWorkListener.onEventRegistered(isA(UnitOfWork.class), any(EventMessage.class)))
.thenAnswer(new Parameter(1));
when(mockInterceptor.handle(any(CommandMessage.class), any(UnitOfWork.class), any(InterceptorChain.class)))
.thenAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {