use of io.spine.envelope.FailureEnvelope in project core-java by SpineEventEngine.
the class FailureBusShould method deliver_postponed_failure_to_dispatcher_using_configured_executor.
@Test
public void deliver_postponed_failure_to_dispatcher_using_configured_executor() {
final BareDispatcher dispatcher = new BareDispatcher();
failureBusWithPostponedExecution.register(dispatcher);
final Failure failure = invalidProjectNameFailure();
failureBusWithPostponedExecution.post(failure);
final Set<FailureEnvelope> postponedFailures = postponedDelivery.getPostponedFailures();
final FailureEnvelope postponedFailure = postponedFailures.iterator().next();
verify(delegateDispatcherExecutor, never()).execute(any(Runnable.class));
postponedDelivery.deliverNow(postponedFailure, dispatcher.getClass());
assertTrue(dispatcher.isDispatchCalled());
verify(delegateDispatcherExecutor).execute(any(Runnable.class));
}
Aggregations