@Test public void errorPassedToFailure() { RetrofitError exception = RetrofitError.unexpectedError("", null); when(callbackRunnable.obtainResponse()).thenThrow(exception); callbackRunnable.run(); verify(executor).execute(any(Runnable.class)); verify(callback).failure(same(exception)); }
@Test public void responsePassedToSuccess() { ResponseWrapper wrapper = new ResponseWrapper(null, new Object()); when(callbackRunnable.obtainResponse()).thenReturn(wrapper); callbackRunnable.run(); verify(executor).execute(any(Runnable.class)); verify(callback).success(same(wrapper.responseBody), same(wrapper.response)); }