theStubber = doAnswer(new AsyncCallbackThrowableAnswer(aTestException));
} else {
theStubber.doAnswer(new AsyncCallbackThrowableAnswer(aTestException));
}
} while(++i < aLoops);
theStubber.doNothing().when(myEventServiceAsyncMock).listen(any(AsyncCallback.class));
//When no events are available, there will not follow a successful call.
if(aLoops > 0 && anEvents != null && !anEvents.isEmpty()) {
doAnswer(new AsyncCallbackAnswer(anEvents)).doNothing().when(myEventServiceAsyncMock).listen(any(AsyncCallback.class));
}