Search in sources :

Example 1 with ValidHandlerOneParamReturnsList

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

the class CommandHandlerMethodShould method invoke_handler_method_and_return_message_list.

@Test
public void invoke_handler_method_and_return_message_list() {
    final ValidHandlerOneParamReturnsList handlerObject = spy(new ValidHandlerOneParamReturnsList());
    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);
    assertEquals(1, events.size());
    final RefProjectCreated event = (RefProjectCreated) events.get(0);
    assertEquals(cmd.getProjectId(), event.getProjectId());
}
Also used : RefProjectCreated(io.spine.test.reflect.event.RefProjectCreated) RefCreateProject(io.spine.test.reflect.command.RefCreateProject) ValidHandlerOneParamReturnsList(io.spine.server.command.given.CommandHandlerMethodTestEnv.ValidHandlerOneParamReturnsList) Test(org.junit.Test)

Example 2 with ValidHandlerOneParamReturnsList

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

the class CommandHandlerMethodShould method consider_handler_with_one_msg_param_which_returns_list_valid.

@Test
public void consider_handler_with_one_msg_param_which_returns_list_valid() {
    final Method handler = new ValidHandlerOneParamReturnsList().getHandler();
    assertIsCommandHandler(handler, true);
}
Also used : Method(java.lang.reflect.Method) ValidHandlerOneParamReturnsList(io.spine.server.command.given.CommandHandlerMethodTestEnv.ValidHandlerOneParamReturnsList) Test(org.junit.Test)

Aggregations

ValidHandlerOneParamReturnsList (io.spine.server.command.given.CommandHandlerMethodTestEnv.ValidHandlerOneParamReturnsList)2 Test (org.junit.Test)2 RefCreateProject (io.spine.test.reflect.command.RefCreateProject)1 RefProjectCreated (io.spine.test.reflect.event.RefProjectCreated)1 Method (java.lang.reflect.Method)1