DirectPolicyChain extends NoOpPolicyChain { @Override public void doNext(Request request, Response response) { errorHandler.handle(new PolicyChainProcessorFailure(policyResult)); } DirectPolicyChain(PolicyResult policyResult, ExecutionContext executionContext); @Override void doNext(Request request, Response response); PolicyResult policyResult();  }
@Test public void shouldCallResultHandler() { Handler<ExecutionContext> resultHandler = Mockito.spy(Handler.class); directPolicyChain = new DirectPolicyChain(policyResult, executionContext); directPolicyChain.handler(resultHandler); directPolicyChain.errorHandler(new Handler<ProcessorFailure>() { @Override public void handle(ProcessorFailure failure) { } }); directPolicyChain.doNext(Mockito.mock(Request.class), Mockito.mock(Response.class)); }