@Test
public void shouldPostResponse() throws Exception {

    // the response
    final Object responseContent = new Object();
    // local request processor returns non null reponse
    Mockito.when(mLocalRequestProcessor.getLocalResponse()).thenReturn(responseContent);
    Assertions.assertThat(mLocalDispatcher.dispatch()).isEqualTo(true);
    Mockito.verify(mRequestQueue).take();
    Mockito.verify(mRequest).addMarker("local-queue-take");
    Mockito.verify(mRequest).addMarker("local-response-get-content-successful");
    Mockito.verify(mResponseDelivery).postResponse(Mockito.eq(mRequest), Mockito.argThat(new ArgumentMatcher<BallResponse<?>>() {
        @Override
        public boolean matches(Object argument) {
            if (argument instanceof BallResponse ) {
                BallResponse response = (BallResponse) argument;
                // response should be local and intermediate
                if (response.getResponseSource() == BallResponse.ResponseSource.LOCAL &&
                        response.isIntermediate() && response.getResult().equals(responseContent)) {
                    return true;
                }
            }
            return false;
        }
    }));
    Mockito.verifyNoMoreInteractions(mResponseDelivery);
}