use of io.gravitee.gateway.policy.impl.PolicyChain in project gravitee-gateway by gravitee-io.
the class ResponsePolicyChainTest method doNext_streamablePolicy.
@Test
public void doNext_streamablePolicy() throws Exception {
StreamablePolicy policy4 = spy(new StreamablePolicy());
ExecutionContext executionContext = mock(ExecutionContext.class);
ReadWriteStream stream = spy(new BufferedReadWriteStream());
when(policy4.onResponseContent(any(Request.class), any(Response.class), any(io.gravitee.policy.api.PolicyChain.class), eq(executionContext))).thenReturn(stream);
PolicyChain chain = ResponsePolicyChain.create(Collections.singletonList(policy4), executionContext);
chain.setResultHandler(result -> {
});
chain.doNext(null, null);
verify(stream, atLeastOnce()).bodyHandler(any(Handler.class));
verify(stream, atLeastOnce()).endHandler(any(Handler.class));
verify(policy4, atLeastOnce()).onResponse(null, null, chain, executionContext);
}
Aggregations