use of com.nike.riposte.server.handler.base.PipelineContinuationBehavior in project riposte by Nike-Inc.
the class RequestContentValidationHandlerTest method doChannelRead_validates_without_validationGroups_if_validationGroups_is_null.
@Test
public void doChannelRead_validates_without_validationGroups_if_validationGroups_is_null() throws Exception {
// given
doReturn(null).when(endpointMock).validationGroups(any());
// when
PipelineContinuationBehavior result = handler.doChannelRead(ctxMock, msg);
// then
verify(requestValidatorMock).validateRequestContent(requestInfoMock);
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_not_call_request_getContent_method_if_endpoint_is_null.
@Test
public void doChannelRead_does_not_call_request_getContent_method_if_endpoint_is_null() throws Exception {
// given
doReturn(null).when(stateMock).getEndpointForExecution();
// when
PipelineContinuationBehavior result = handler.doChannelRead(ctxMock, msg);
// then
verify(requestInfoMock, never()).getContent();
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_request_isContentDeserializerSetup_returns_false.
@Test
public void doChannelRead_does_nothing_if_request_isContentDeserializerSetup_returns_false() throws Exception {
// given
doReturn(false).when(requestInfoMock).isContentDeserializerSetup();
// 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_not_call_request_getContent_method_if_endpoint_does_not_want_validation.
@Test
public void doChannelRead_does_not_call_request_getContent_method_if_endpoint_does_not_want_validation() throws Exception {
// given
doReturn(false).when(endpointMock).isValidateRequestContent(any());
// when
PipelineContinuationBehavior result = handler.doChannelRead(ctxMock, msg);
// then
verify(requestInfoMock, never()).getContent();
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_delegates_to_async_processing_when_requested_by_endpoint.
@Test
public void doChannelRead_delegates_to_async_processing_when_requested_by_endpoint() throws Exception {
// given
doReturn(true).when(endpointMock).shouldValidateAsynchronously(requestInfoMock);
// when
PipelineContinuationBehavior result = handler.doChannelRead(ctxMock, msg);
// then
verify(stateMock).addPreEndpointExecutionWorkChainSegment(any(Function.class));
verifyZeroInteractions(requestValidatorMock);
assertThat(result).isEqualTo(PipelineContinuationBehavior.CONTINUE);
}
Aggregations