use of io.spine.test.reflect.ReflectRejections.InvalidProjectName 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());
}
use of io.spine.test.reflect.ReflectRejections.InvalidProjectName in project core-java by SpineEventEngine.
the class RejectionSubscriberMethodShould method invoke_subscriber_method.
@Test
public void invoke_subscriber_method() throws InvocationTargetException {
final ValidThreeParams subscriberObject = new ValidThreeParams();
final RejectionSubscriberMethod method = new RejectionSubscriberMethod(subscriberObject.getMethod());
final InvalidProjectName rejectionMessage = Given.RejectionMessage.invalidProjectName();
final RejectionContext.Builder builder = RejectionContext.newBuilder();
final CommandContext commandContext = CommandContext.newBuilder().setTargetVersion(1020).build();
final RjUpdateProjectName commandMessage = RjUpdateProjectName.getDefaultInstance();
builder.setCommand(Command.newBuilder().setMessage(pack(commandMessage)).setContext(commandContext));
final RejectionContext rejectionContext = builder.build();
method.invoke(subscriberObject, rejectionMessage, rejectionContext);
assertEquals(rejectionMessage, subscriberObject.getLastRejectionMessage());
assertEquals(commandMessage, subscriberObject.getLastCommandMessage());
assertEquals(commandContext, subscriberObject.getLastCommandContext());
}
Aggregations