use of com.nike.riposte.server.handler.base.PipelineContinuationBehavior in project riposte by Nike-Inc.
the class ResponseSenderHandlerTest method doChannelRead_calls_sendResponse_with_expected_args_and_returns_CONTINUE.
@Test
public void doChannelRead_calls_sendResponse_with_expected_args_and_returns_CONTINUE() throws Exception {
// given
Object msg = new Object();
// when
PipelineContinuationBehavior result = handlerSpy.doChannelRead(ctxMock, msg);
// then
verify(handlerSpy).sendResponse(ctxMock, msg, false);
assertThat(result).isEqualTo(PipelineContinuationBehavior.CONTINUE);
}
use of com.nike.riposte.server.handler.base.PipelineContinuationBehavior in project riposte by Nike-Inc.
the class ResponseSenderHandlerTest method doExceptionCaught_closes_channel_but_does_not_propagate_exception_from_sendResponse.
@Test
public void doExceptionCaught_closes_channel_but_does_not_propagate_exception_from_sendResponse() throws JsonProcessingException {
// given
doThrow(new RuntimeException("intentional test exception")).when(handlerSpy).sendResponse(any(), any(), anyBoolean());
// when
PipelineContinuationBehavior result = handlerSpy.doExceptionCaught(ctxMock, mock(Throwable.class));
// then
verify(handlerSpy).sendResponse(ctxMock, null, true);
assertThat(result).isEqualTo(PipelineContinuationBehavior.CONTINUE);
verify(channelMock).close();
}
use of com.nike.riposte.server.handler.base.PipelineContinuationBehavior in project riposte by Nike-Inc.
the class ResponseSenderHandlerTest method doExceptionCaught_calls_sendResponse_with_expected_args_and_returns_CONTINUE.
@Test
public void doExceptionCaught_calls_sendResponse_with_expected_args_and_returns_CONTINUE() throws Exception {
// when
PipelineContinuationBehavior result = handlerSpy.doExceptionCaught(ctxMock, new Exception("intentional test exception"));
// then
verify(handlerSpy).sendResponse(ctxMock, null, true);
assertThat(result).isEqualTo(PipelineContinuationBehavior.CONTINUE);
verify(channelMock, never()).close();
}
use of com.nike.riposte.server.handler.base.PipelineContinuationBehavior in project riposte by Nike-Inc.
the class RequestContentValidationHandlerTest method doChannelRead_does_nothing_if_endpoint_is_null.
@Test
public void doChannelRead_does_nothing_if_endpoint_is_null() throws Exception {
// given
doReturn(null).when(stateMock).getEndpointForExecution();
// when
PipelineContinuationBehavior result = handler.doChannelRead(ctxMock, msg);
// then
verifyNoMoreInteractions(requestValidatorMock);
assertThat(result).isEqualTo(PipelineContinuationBehavior.CONTINUE);
}
use of com.nike.riposte.server.handler.base.PipelineContinuationBehavior in project riposte by Nike-Inc.
the class RequestContentValidationHandlerTest method doChannelRead_does_nothing_if_content_is_null_and_require_content_is_false.
@Test
public void doChannelRead_does_nothing_if_content_is_null_and_require_content_is_false() throws Exception {
// given
doReturn(null).when(requestInfoMock).getContent();
// when
PipelineContinuationBehavior result = handler.doChannelRead(ctxMock, msg);
// then
verifyNoMoreInteractions(requestValidatorMock);
assertThat(result).isEqualTo(PipelineContinuationBehavior.CONTINUE);
}
Aggregations