use of com.yahoo.jdisc.http.filter.RequestFilter in project vespa by vespa-engine.
the class FilterTestCase method requireThatRequestFilterChainRetainsFilters.
@Test
public void requireThatRequestFilterChainRetainsFilters() {
final RequestFilter requestFilter1 = mock(RequestFilter.class);
final RequestFilter requestFilter2 = mock(RequestFilter.class);
verify(requestFilter1, never()).refer();
verify(requestFilter2, never()).refer();
final ResourceReference reference1 = mock(ResourceReference.class);
final ResourceReference reference2 = mock(ResourceReference.class);
when(requestFilter1.refer()).thenReturn(reference1);
when(requestFilter2.refer()).thenReturn(reference2);
final RequestFilter chain = RequestFilterChain.newInstance(requestFilter1, requestFilter2);
verify(requestFilter1, times(1)).refer();
verify(requestFilter2, times(1)).refer();
verify(reference1, never()).close();
verify(reference2, never()).close();
chain.release();
verify(reference1, times(1)).close();
verify(reference2, times(1)).close();
}
Aggregations