use of io.spine.server.event.Given.Enrichment.GetProjectMaxMemberCount in project core-java by SpineEventEngine.
the class EventEnricherShould method enrich_event_if_function_added_at_runtime.
@Test
public void enrich_event_if_function_added_at_runtime() {
final GetProjectMaxMemberCount function = new GetProjectMaxMemberCount();
enricher.registerFieldEnrichment(ProjectId.class, Integer.class, function);
final ProjectCreated msg = projectCreated();
final ProjectId projectId = msg.getProjectId();
eventBus.post(createEvent(msg));
// the `function` was specially implemented to return non-null ints.
@SuppressWarnings("ConstantConditions") final int expectedValue = function.apply(projectId);
assertEquals(expectedValue, subscriber.projectCreatedDynamicEnrichment.getMaxMemberCount());
}
Aggregations