Search in sources :

Example 1 with RValidThreeParams

use of io.spine.server.rejection.given.RejectionReactorMethodTestEnv.RValidThreeParams in project core-java by SpineEventEngine.

the class RejectionReactorMethodShould method consider_reactor_with_both_messages_and_context_params_valid.

@Test
public void consider_reactor_with_both_messages_and_context_params_valid() {
    final Method reactor = new RValidThreeParams().getMethod();
    assertIsRejectionReactor(reactor, true);
}
Also used : Method(java.lang.reflect.Method) RValidThreeParams(io.spine.server.rejection.given.RejectionReactorMethodTestEnv.RValidThreeParams) Test(org.junit.Test)

Example 2 with RValidThreeParams

use of io.spine.server.rejection.given.RejectionReactorMethodTestEnv.RValidThreeParams in project core-java by SpineEventEngine.

the class RejectionReactorMethodShould method invoke_reactor_method.

@Test
public void invoke_reactor_method() throws InvocationTargetException {
    final RValidThreeParams reactorObject = new RValidThreeParams();
    final RejectionReactorMethod reactor = new RejectionReactorMethod(reactorObject.getMethod());
    final InvalidProjectName rejectionMessage = Given.RejectionMessage.invalidProjectName();
    final RejectionContext.Builder builder = RejectionContext.newBuilder();
    final CommandContext commandContext = CommandContext.newBuilder().setTargetVersion(3040).build();
    final RjUpdateProjectName commandMessage = RjUpdateProjectName.getDefaultInstance();
    builder.setCommand(Command.newBuilder().setMessage(pack(commandMessage)).setContext(commandContext));
    final RejectionContext rejectionContext = builder.build();
    reactor.invoke(reactorObject, rejectionMessage, rejectionContext);
    assertEquals(rejectionMessage, reactorObject.getLastRejectionMessage());
    assertEquals(commandMessage, reactorObject.getLastCommandMessage());
    assertEquals(commandContext, reactorObject.getLastCommandContext());
}
Also used : CommandContext(io.spine.core.CommandContext) InvalidProjectName(io.spine.test.reflect.ReflectRejections.InvalidProjectName) RejectionContext(io.spine.core.RejectionContext) RjUpdateProjectName(io.spine.test.rejection.command.RjUpdateProjectName) RValidThreeParams(io.spine.server.rejection.given.RejectionReactorMethodTestEnv.RValidThreeParams) Test(org.junit.Test)

Aggregations

RValidThreeParams (io.spine.server.rejection.given.RejectionReactorMethodTestEnv.RValidThreeParams)2 Test (org.junit.Test)2 CommandContext (io.spine.core.CommandContext)1 RejectionContext (io.spine.core.RejectionContext)1 InvalidProjectName (io.spine.test.reflect.ReflectRejections.InvalidProjectName)1 RjUpdateProjectName (io.spine.test.rejection.command.RjUpdateProjectName)1 Method (java.lang.reflect.Method)1