@Test
public void shouldPostResponseAndAddMarkerLog() {

    Executor executorMock = mock(Executor.class);
    BallResponseDelivery responseDelivery = new BallExecutorDelivery(executorMock);
    final Runnable runnable = new Runnable() {
        @Override
        public void run() {
            doThrow(new MockitoException("Runnable should not run"));
        }
    };
    doNothing().when(executorMock).execute(any(Runnable.class));
    responseDelivery.postResponse(mRequest, mResponse);
    responseDelivery.postResponse(mRequest, mResponse, runnable);
    verify(mRequest, times(2)).addMarker(BallExecutorDelivery.MARKER_POST_RESPONSE);
    verify(executorMock).execute(argThat(new ArgumentMatcher<BallExecutorDelivery.ResponseDeliveryRunnable>() {
        @Override
        public boolean matches(Object argument) {
            BallExecutorDelivery.ResponseDeliveryRunnable r = (BallExecutorDelivery.ResponseDeliveryRunnable) argument;
            return r.mRequest == mRequest && r.mResponse == mResponse && r.mRunnable == null;
        }
    }));
    verify(executorMock).execute(argThat(new ArgumentMatcher<BallExecutorDelivery.ResponseDeliveryRunnable>() {
        @Override
        public boolean matches(Object argument) {
            BallExecutorDelivery.ResponseDeliveryRunnable r = (BallExecutorDelivery.ResponseDeliveryRunnable) argument;
            return r.mRequest == mRequest && r.mResponse == mResponse && r.mRunnable == runnable;
        }
    }));
}