Search in sources :

Example 1 with FailureEnvelope

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));
}
Also used : FailureEnvelope(io.spine.envelope.FailureEnvelope) Failure(io.spine.base.Failure) Test(org.junit.Test)

Aggregations

Failure (io.spine.base.Failure)1 FailureEnvelope (io.spine.envelope.FailureEnvelope)1 Test (org.junit.Test)1