Search in sources :

Example 1 with GetProjectMaxMemberCount

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());
}
Also used : GetProjectMaxMemberCount(io.spine.server.event.Given.Enrichment.GetProjectMaxMemberCount) ProjectId(io.spine.test.event.ProjectId) ProjectCreated(io.spine.test.event.ProjectCreated) Test(org.junit.Test)

Aggregations

GetProjectMaxMemberCount (io.spine.server.event.Given.Enrichment.GetProjectMaxMemberCount)1 ProjectCreated (io.spine.test.event.ProjectCreated)1 ProjectId (io.spine.test.event.ProjectId)1 Test (org.junit.Test)1