@Test
public void shouldDeliverIntermediateAndThenStoredFinalErrorResponse() {

    VolleyError error = new VolleyError("Some error");
    Object response = new Object();
    when(mRequest.isIntermediateResponseDelivered()).thenReturn(false);
    when(mRequest.isFinalResponseDelivered()).thenReturn(true);
    when(mRequest.getFinalResponseError()).thenReturn(error);
    when(mResponse.isIntermediate()).thenReturn(true);
    when(mResponse.isSuccess()).thenReturn(true);
    when(mResponse.getResult()).thenReturn(response);
    when(mResponse.getResponseSource()).thenReturn(BallResponse.ResponseSource.CACHE);
    mResponseDelivery.postResponse(mRequest, mResponse);
    verify(mRequest).deliverIntermediateResponse(response, BallResponse.ResponseSource.CACHE);
    verify(mRequest).deliverError(error);
    verify(mRequest, new LastInteraction()).finish(BallExecutorDelivery.MARKER_DONE_WITH_INTERMEDIATE_RESPONSE);
}