use of io.spine.test.event.ProjectCreated in project core-java by SpineEventEngine.
the class EnrichmentFunctionShould method apply_enrichment.
@Test
public void apply_enrichment() throws Exception {
final ProjectCreated event = Given.EventMessage.projectCreated();
final ProjectCreated.Enrichment enriched = fieldEnricher.apply(event);
assertNotNull(enriched);
assertEquals(event.getProjectId().getId(), enriched.getProjectName());
}
use of io.spine.test.event.ProjectCreated in project core-java by SpineEventEngine.
the class EventEnricherShould method enrich_event_with_several_fields_by_same_source_id.
@Test
public void enrich_event_with_several_fields_by_same_source_id() {
final ProjectCreated msg = projectCreated();
final ProjectId projectId = msg.getProjectId();
eventBus.post(createEvent(msg));
assertEquals(getProjectName.apply(projectId), subscriber.projectCreatedEnrichment.getProjectName());
assertEquals(getProjectOwnerId.apply(projectId), subscriber.projectCreatedEnrichment.getOwnerId());
}
use of io.spine.test.event.ProjectCreated 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());
}
use of io.spine.test.event.ProjectCreated in project core-java by SpineEventEngine.
the class EventEnricherShould method enrich_event_if_enrichment_definition_is_not_enclosed_to_event_same_package.
@Test
public void enrich_event_if_enrichment_definition_is_not_enclosed_to_event_same_package() {
final ProjectCreated msg = projectCreated();
eventBus.post(createEvent(msg));
assertEquals(getProjectName.apply(msg.getProjectId()), subscriber.projectCreatedSeparateEnrichment.getProjectName());
}
use of io.spine.test.event.ProjectCreated in project core-java by SpineEventEngine.
the class EventEnricherShould method enrich_event_if_enrichment_definition_is_in_another_package.
@Test
public void enrich_event_if_enrichment_definition_is_in_another_package() {
final ProjectCreated msg = projectCreated();
eventBus.post(createEvent(msg));
assertEquals(getProjectName.apply(msg.getProjectId()), subscriber.projectCreatedAnotherPackEnrichment.getProjectName());
}
Aggregations