use of io.spine.server.rejection.given.RejectionEnrichmentConsumer in project core-java by SpineEventEngine.
the class RejectionEnricherShould method boolean_enrich_rejection.
@Test
public void boolean_enrich_rejection() {
final RejectionEnrichmentConsumer consumer = new RejectionEnrichmentConsumer();
rejectionBus.register(consumer);
final Rejection rejection = invalidProjectNameRejection();
rejectionBus.post(rejection);
final RejectionContext context = consumer.getContext();
final Enrichment enrichment = context.getEnrichment();
assertNotEquals(Enrichment.getDefaultInstance(), enrichment);
final Optional<ProjectRejections.ProjectInfo> optional = Enrichments.getEnrichment(ProjectRejections.ProjectInfo.class, context);
assertTrue(optional.isPresent());
assertTrue(optional.get().getProjectName().startsWith(PROJECT_NAME_PREFIX));
}
Aggregations