Search in sources :

Example 1 with ProjectAggregate

use of io.spine.server.aggregate.given.AggregateCommandEndpointTestEnv.ProjectAggregate in project core-java by SpineEventEngine.

the class AggregateCommandEndpointShould method store_aggregate_on_command_dispatching.

@Test
public void store_aggregate_on_command_dispatching() {
    final CommandEnvelope cmd = CommandEnvelope.of(createProject(projectId));
    final AggCreateProject msg = (AggCreateProject) cmd.getMessage();
    repository.dispatch(cmd);
    final Optional<ProjectAggregate> optional = repository.find(projectId);
    assertTrue(optional.isPresent());
    final ProjectAggregate aggregate = optional.get();
    assertEquals(projectId, aggregate.getId());
    assertEquals(msg.getName(), aggregate.getState().getName());
}
Also used : ProjectAggregate(io.spine.server.aggregate.given.AggregateCommandEndpointTestEnv.ProjectAggregate) CommandEnvelope(io.spine.core.CommandEnvelope) AggCreateProject(io.spine.test.aggregate.command.AggCreateProject) Test(org.junit.Test)

Aggregations

CommandEnvelope (io.spine.core.CommandEnvelope)1 ProjectAggregate (io.spine.server.aggregate.given.AggregateCommandEndpointTestEnv.ProjectAggregate)1 AggCreateProject (io.spine.test.aggregate.command.AggCreateProject)1 Test (org.junit.Test)1