use of io.spine.server.event.enrich.EventEnricher in project core-java by SpineEventEngine.
the class EventBusShould method allow_enrichment_configuration_at_runtime_if_enricher_previously_set.
@Test
public void allow_enrichment_configuration_at_runtime_if_enricher_previously_set() {
final EventEnricher enricher = mock(EventEnricher.class);
setUp(enricher);
final Class<ProjectId> eventFieldClass = ProjectId.class;
final Class<String> enrichmentFieldClass = String.class;
final Function<ProjectId, String> function = new Function<ProjectId, String>() {
@Override
public String apply(@Nullable ProjectId input) {
checkNotNull(input);
return input.toString();
}
};
eventBus.addFieldEnrichment(eventFieldClass, enrichmentFieldClass, function);
verify(enricher).registerFieldEnrichment(eq(eventFieldClass), eq(enrichmentFieldClass), eq(function));
}
use of io.spine.server.event.enrich.EventEnricher in project core-java by SpineEventEngine.
the class EventBusBuilderShould method return_set_Enricher.
@Test
public void return_set_Enricher() {
final EventEnricher enricher = mock(EventEnricher.class);
assertEquals(enricher, EventBus.newBuilder().setStorageFactory(storageFactory).setEnricher(enricher).getEnricher().get());
}