use of io.spine.server.projection.given.ProjectionRepositoryTestEnv.TestProjectionRepository in project core-java by SpineEventEngine.
the class ProjectionRepositoryShould method log_error_if_dispatch_unknown_event.
@Test
public void log_error_if_dispatch_unknown_event() {
final StringValue unknownEventMessage = StringValue.getDefaultInstance();
final Event event = GivenEvent.withMessage(unknownEventMessage);
repository().dispatch(EventEnvelope.of(event));
TestProjectionRepository testRepo = (TestProjectionRepository) repository();
assertTrue(testRepo.getLastErrorEnvelope() instanceof EventEnvelope);
assertEquals(Events.getMessage(event), testRepo.getLastErrorEnvelope().getMessage());
assertEquals(event, testRepo.getLastErrorEnvelope().getOuterObject());
// It must be "illegal argument type" since projections of this repository
// do not handle such events.
assertTrue(testRepo.getLastException() instanceof IllegalArgumentException);
}
Aggregations