use of io.spine.test.reflect.event.RefProjectCreated in project core-java by SpineEventEngine.
the class EventSubscriberMethodShould method invoke_subscriber_method.
@Test
public void invoke_subscriber_method() throws InvocationTargetException {
final ValidTwoParams subscriberObject;
subscriberObject = spy(new ValidTwoParams());
final EventSubscriberMethod subscriber = EventSubscriberMethod.from(subscriberObject.getMethod());
final RefProjectCreated msg = Given.EventMessage.projectCreated();
subscriber.invoke(subscriberObject, msg, EventContext.getDefaultInstance());
verify(subscriberObject, times(1)).handle(msg, EventContext.getDefaultInstance());
}
use of io.spine.test.reflect.event.RefProjectCreated in project core-java by SpineEventEngine.
the class EventApplierMethodShould method invoke_applier_method.
@Test
public void invoke_applier_method() throws InvocationTargetException {
final ValidApplier applierObject = new ValidApplier();
final EventApplierMethod applier = EventApplierMethod.from(applierObject.getMethod());
final RefProjectCreated event = Sample.messageOfType(RefProjectCreated.class);
applier.invoke(applierObject, event);
assertEquals(event, applierObject.eventApplied);
}
use of io.spine.test.reflect.event.RefProjectCreated 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());
}
use of io.spine.test.reflect.event.RefProjectCreated 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