@SuppressWarnings("unchecked")
@Test
public void testCallbackInvokedBeforeUnitOfWorkCleanup() throws Throwable {
CommandHandlerInterceptor mockHandlerInterceptor = mock(CommandHandlerInterceptor.class);
CommandDispatchInterceptor mockDispatchInterceptor = mock(CommandDispatchInterceptor.class);
when(mockDispatchInterceptor.handle(isA(CommandMessage.class))).thenAnswer(new Parameter(0));
ExecutorService customExecutor = Executors.newCachedThreadPool();
testSubject = new DisruptorCommandBus(
inMemoryEventStore, eventBus,
new DisruptorConfiguration().setInvokerInterceptors(Arrays.asList(mockHandlerInterceptor))
.setDispatchInterceptors(Arrays.asList(mockDispatchInterceptor))