@Test public void shouldPostEmptyIntermediateResponseAndAddMarkerLog() { final BallResponse.ResponseSource responseSource = BallResponse.ResponseSource.LOCAL; Executor executorMock = mock(Executor.class); BallResponseDelivery responseDelivery = new BallExecutorDelivery(executorMock); doNothing().when(executorMock).execute(any(Runnable.class)); responseDelivery.postEmptyIntermediateResponse(mRequest, responseSource); verify(mRequest).addMarker(BallExecutorDelivery.MARKER_POST_EMPTY_INTERMEDIATE_RESPONSE); verify(executorMock).execute(argThat(new ArgumentMatcher<Runnable>() { @Override public boolean matches(Object argument) { BallExecutorDelivery.EmptyIntermediateDeliveryRunnable r = (BallExecutorDelivery.EmptyIntermediateDeliveryRunnable) argument; return r.mRequest == mRequest && r.mResponseSource == responseSource; } })); verifyNoMoreInteractions(mRequest); }
@Override public void postEmptyIntermediateResponse(BallRequest request, BallResponse.ResponseSource responseSource) { request.addMarker(MARKER_POST_EMPTY_INTERMEDIATE_RESPONSE); mResponsePoster.execute(new EmptyIntermediateDeliveryRunnable(request, responseSource, mNetworkQueue)); }
BallExecutorDelivery implements BallResponseDelivery { @Override public void postEmptyIntermediateResponse(BallRequest request, BallResponse.ResponseSource responseSource) { request.addMarker(MARKER_POST_EMPTY_INTERMEDIATE_RESPONSE); mResponsePoster.execute(new EmptyIntermediateDeliveryRunnable(request, responseSource, mNetworkQueue)); } }
BallExecutorDelivery implements BallResponseDelivery { @Override public void postEmptyIntermediateResponse(BallRequest request, BallResponse.ResponseSource responseSource) { request.addMarker(MARKER_POST_EMPTY_INTERMEDIATE_RESPONSE); mResponsePoster.execute(new EmptyIntermediateDeliveryRunnable(request, responseSource, mNetworkQueue)); } BallExecutorDelivery(final Handler handler, PriorityBlockingQueue<BallRequest> networkQueue);  BallExecutorDelivery(Executor executor); }
BallExecutorDelivery implements BallResponseDelivery { @Override public void postEmptyIntermediateResponse(BallRequest request, BallResponse.ResponseSource responseSource) { request.addMarker(MARKER_POST_EMPTY_INTERMEDIATE_RESPONSE); mResponsePoster.execute(new EmptyIntermediateDeliveryRunnable(request, responseSource, mNetworkQueue)); } BallExecutorDelivery(final Handler handler, PriorityBlockingQueue<BallRequest> networkQueue);  BallExecutorDelivery(Executor executor); @Override void postResponse(BallRequest<?> request, BallResponse<?> response); @Override void postResponseAndForwardToNetwork(BallRequest<?> request, BallResponse<?> response); @Override void postError(BallRequest<?> request, VolleyError error); @Override void postEmptyIntermediateResponse(BallRequest request, BallResponse.ResponseSource responseSource); }
BallExecutorDelivery implements BallResponseDelivery { @Override public void postEmptyIntermediateResponse(BallRequest request, BallResponse.ResponseSource responseSource) { request.addMarker(MARKER_POST_EMPTY_INTERMEDIATE_RESPONSE); mResponsePoster.execute(new EmptyIntermediateDeliveryRunnable(request, responseSource, mNetworkQueue)); } BallExecutorDelivery(final Handler handler, PriorityBlockingQueue<BallRequest> networkQueue);  BallExecutorDelivery(Executor executor); @Override void postResponse(BallRequest<?> request, BallResponse<?> response); @Override void postResponseAndForwardToNetwork(BallRequest<?> request, BallResponse<?> response); @Override void postError(BallRequest<?> request, VolleyError error); @Override void postEmptyIntermediateResponse(BallRequest request, BallResponse.ResponseSource responseSource); static final String MARKER_POST_EMPTY_INTERMEDIATE_RESPONSE; static final String MARKER_POST_RESPONSE; static final String MARKER_POST_ERROR; static final String MARKER_INTERMEDIATE_RESPONSE_ALREADY_DELIVERED; static final String MARKER_DONE_WITH_RESPONSE_FROM; static final String MARKER_ERROR_IN_FINAL_RESPONSE_LET_INTERMEDIATE_CONTINUE; static final String MARKER_DONE_WITH_INTERMEDIATE_EMPTY_RESPONSE; static final String MARKER_DONE_WITH_INTERMEDIATE_RESPONSE; }