use of com.linkedin.restli.internal.server.filter.testfilters.CountFilterResponseErrorThrowsError in project rest.li by linkedin.
the class TestRestLiFilterChain method testFilterInvocationResponseErrorThrowsError.
@SuppressWarnings(value = "unchecked")
@Test
public void testFilterInvocationResponseErrorThrowsError() throws Exception {
_restLiFilterChain = new RestLiFilterChain(Arrays.asList(_filters), _mockFilterChainCallback);
_filters[1] = new CountFilterResponseErrorThrowsError();
doAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
_restLiFilterChain.onResponse(_mockFilterRequestContext, _mockFilterResponseContext, _mockResponseAttachments);
return null;
}
}).when(_mockFilterChainCallback).onRequestSuccess(eq(_mockRestLiRequestData), any(RestLiCallback.class));
when(_mockFilterRequestContext.getRequestData()).thenReturn(_mockRestLiRequestData);
when(_mockFilterResponseContext.getResponseData()).thenReturn(_mockRestLiResponseData);
when(_mockFilterResponseContextFactory.fromThrowable(any(Throwable.class))).thenReturn(_mockFilterResponseContext);
_restLiFilterChain.onRequest(_mockFilterRequestContext, _mockFilterResponseContextFactory);
verifySecondFilterResponseException();
}
Aggregations