Search in sources :

Example 1 with RejectingAggregate

use of io.spine.server.command.given.CommandHandlerMethodTestEnv.RejectingAggregate in project core-java by SpineEventEngine.

the class CommandHandlerMethodShould method set_producer_ID_if_entity.

@Test
public void set_producer_ID_if_entity() {
    final RefCreateProject commandMessage = createProject();
    final Aggregate<ProjectId, ?, ?> entity = new RejectingAggregate(commandMessage.getProjectId());
    final CommandEnvelope cmd = requestFactory.createEnvelope(commandMessage);
    try {
        AggregateMessageDispatcher.dispatchCommand(entity, cmd);
    } catch (HandlerMethodFailedException e) {
        assertCauseAndId(e, entity.getId());
    }
}
Also used : RefCreateProject(io.spine.test.reflect.command.RefCreateProject) HandlerMethodFailedException(io.spine.server.model.HandlerMethodFailedException) RejectingAggregate(io.spine.server.command.given.CommandHandlerMethodTestEnv.RejectingAggregate) ProjectId(io.spine.test.reflect.ProjectId) CommandEnvelope(io.spine.core.CommandEnvelope) Test(org.junit.Test)

Aggregations

CommandEnvelope (io.spine.core.CommandEnvelope)1 RejectingAggregate (io.spine.server.command.given.CommandHandlerMethodTestEnv.RejectingAggregate)1 HandlerMethodFailedException (io.spine.server.model.HandlerMethodFailedException)1 ProjectId (io.spine.test.reflect.ProjectId)1 RefCreateProject (io.spine.test.reflect.command.RefCreateProject)1 Test (org.junit.Test)1