use of io.spine.server.command.given.CommandHandlerMethodTestEnv.ValidHandlerTwoParams in project core-java by SpineEventEngine.
the class CommandHandlerMethodShould method consider_handler_with_msg_and_context_params_valid.
@Test
public void consider_handler_with_msg_and_context_params_valid() {
final Method handler = new ValidHandlerTwoParams().getHandler();
assertIsCommandHandler(handler, true);
}
use of io.spine.server.command.given.CommandHandlerMethodTestEnv.ValidHandlerTwoParams in project core-java by SpineEventEngine.
the class CommandHandlerMethodShould method invoke_handler_method_which_returns_one_message.
@Test
public void invoke_handler_method_which_returns_one_message() {
final ValidHandlerTwoParams handlerObject = spy(new ValidHandlerTwoParams());
final CommandHandlerMethod handler = from(handlerObject.getHandler());
final RefCreateProject cmd = createProject();
final List<? extends Message> events = handler.invoke(handlerObject, cmd, emptyContext);
verify(handlerObject, times(1)).handleTest(cmd, emptyContext);
assertEquals(1, events.size());
final RefProjectCreated event = (RefProjectCreated) events.get(0);
assertEquals(cmd.getProjectId(), event.getProjectId());
}
Aggregations