Search in sources :

Example 1 with ValidHandlerTwoParams

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);
}
Also used : Method(java.lang.reflect.Method) ValidHandlerTwoParams(io.spine.server.command.given.CommandHandlerMethodTestEnv.ValidHandlerTwoParams) Test(org.junit.Test)

Example 2 with ValidHandlerTwoParams

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());
}
Also used : RefProjectCreated(io.spine.test.reflect.event.RefProjectCreated) RefCreateProject(io.spine.test.reflect.command.RefCreateProject) ValidHandlerTwoParams(io.spine.server.command.given.CommandHandlerMethodTestEnv.ValidHandlerTwoParams) Test(org.junit.Test)

Aggregations

ValidHandlerTwoParams (io.spine.server.command.given.CommandHandlerMethodTestEnv.ValidHandlerTwoParams)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