class 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));
    }

}

class BallExecutorDeliveryTest {

    private BallResponseDelivery mResponseDelivery;
    private BallRequest mRequest;
    private BallResponse mResponse;

    @Test
    public void shouldIgnoreEmptyIntermediateResponseWhenFinalIsNotDelivered() {

        when(mRequest.isFinished()).thenReturn(false);
        when(mRequest.isIntermediateResponseDelivered()).thenReturn(false);
        when(mRequest.isFinalResponseDelivered()).thenReturn(false);

        mResponseDelivery.postEmptyIntermediateResponse(mRequest, BallResponse.ResponseSource.LOCAL);

        verify(mRequest).setIntermediateResponseDelivered(true);
        verify(mRequest, never()).deliverError(any(VolleyError.class));
        verify(mRequest, never()).finish(anyString());
    }

}