use of io.spine.server.event.given.EventSubscriberTestEnv.FailingSubscriber in project core-java by SpineEventEngine.
the class EventSubscriberShould method dispatch_event.
@Test
public void dispatch_event() {
final EventEnvelope eventEnvelope = createEvent(true);
final Set<String> dispatchingResult = subscriber.dispatch(eventEnvelope);
final FailingSubscriber sub = (FailingSubscriber) this.subscriber;
assertTrue(sub.isMethodCalled());
assertEquals(1, dispatchingResult.size());
assertNull(sub.getLastException());
}
use of io.spine.server.event.given.EventSubscriberTestEnv.FailingSubscriber in project core-java by SpineEventEngine.
the class EventSubscriberShould method catch_exceptions_caused_by_methods.
@Test
public void catch_exceptions_caused_by_methods() {
// Create event which should fail.
final EventEnvelope eventEnvelope = createEvent(false);
final Set<String> dispatchingResult = subscriber.dispatch(eventEnvelope);
final FailingSubscriber sub = (FailingSubscriber) this.subscriber;
assertTrue(sub.isMethodCalled());
assertEquals(0, dispatchingResult.size());
assertEquals(eventEnvelope, sub.getLastErrorEnvelope());
assertNotNull(sub.getLastException());
}
Aggregations