ExecutorService mockExecutorService = mock(ExecutorService.class);
testSubject = new EventProcessor(mockExecutorService, new NullShutdownCallback(),
new DefaultErrorHandler(RetryPolicy.retryAfter(500, TimeUnit.MILLISECONDS)),
new DefaultUnitOfWorkFactory(mockTransactionManager),
Collections.singleton(listener), multiplexingEventProcessingMonitor);
doThrow(new MockException()).doNothing().when(listener).handle(event1);
testSubject.scheduleEvent(event1);
testSubject.scheduleEvent(event2);
long t1 = System.currentTimeMillis();
testSubject.run();
// we simulate the immediate scheduling of the yielded task by executing run again