use of com.nike.riposte.server.http.filter.RequestAndResponseFilter in project riposte by Nike-Inc.
the class HttpChannelInitializerTest method constructor_handles_empty_before_security_request_handlers.
@Test
public void constructor_handles_empty_before_security_request_handlers() {
// given
RequestAndResponseFilter afterSecurityRequestFilter = mock(RequestAndResponseFilter.class);
doReturn(false).when(afterSecurityRequestFilter).shouldExecuteBeforeSecurityValidation();
List<RequestAndResponseFilter> reqResFilters = Arrays.asList(afterSecurityRequestFilter);
// when
HttpChannelInitializer hci = new HttpChannelInitializer(null, 42, Arrays.asList(getMockEndpoint("/some/path")), reqResFilters, null, mock(RiposteErrorHandler.class), mock(RiposteUnhandledErrorHandler.class), null, null, mock(ResponseSender.class), null, 4242L, null, null, null, 121, 42, 321, 100, false, null);
// then
RequestFilterHandler beforeSecReqFH = extractField(hci, "afterSecurityRequestFilterHandler");
assertThat(extractField(beforeSecReqFH, "filters"), is(Collections.singletonList(afterSecurityRequestFilter)));
assertThat(extractField(hci, "beforeSecurityRequestFilterHandler"), nullValue());
ResponseFilterHandler responseFilterHandler = extractField(hci, "cachedResponseFilterHandler");
assertThat(extractField(responseFilterHandler, "filtersInResponseProcessingOrder"), is(reqResFilters));
}
use of com.nike.riposte.server.http.filter.RequestAndResponseFilter in project riposte by Nike-Inc.
the class HttpChannelInitializerTest method createRequestAndResponseFilterMock.
private List<RequestAndResponseFilter> createRequestAndResponseFilterMock() {
RequestAndResponseFilter beforeSecurityRequestFilter = mock(RequestAndResponseFilter.class);
doReturn(true).when(beforeSecurityRequestFilter).shouldExecuteBeforeSecurityValidation();
return Arrays.asList(beforeSecurityRequestFilter);
}
Aggregations