@Test public void execute_PassesThrownExceptions() throws Exception { IOException error = new IOException(); doThrow(error).when(mockOkHttpCall).execute(); expectedException.expect(is(error)); testCall.execute(); ApiError apiError = new ApiError(5000, ""); doThrow(apiError).when(mockOkHttpCall).execute(); expectedException.expect(is(apiError)); testCall.execute(); }
@Override public T execute() throws IOException, ApiError { Response response = rawCall.execute(); return adapt(response); }
OkHttpCall implements Call<T> { @Override public T execute() throws IOException, ApiError { Response response = rawCall.execute(); return adapt(response); } }
OkHttpCall implements Call<T> { @Override public T execute() throws IOException, ApiError { Response response = rawCall.execute(); return adapt(response); } OkHttpCall(okhttp3.Call rawCall, ResponseAdapter<T> adapter); }
OkHttpCall implements Call<T> { @Override public T execute() throws IOException, ApiError { Response response = rawCall.execute(); return adapt(response); } OkHttpCall(okhttp3.Call rawCall, ResponseAdapter<T> adapter); @Override T execute(); @Override void enqueue(final Callback<T> callback); @Override boolean isExecuted(); @Override void cancel(); @Override boolean isCanceled(); @SuppressWarnings("CloneDoesntCallSuperClone") @Override OkHttpCall<T> clone(); }
OkHttpCall implements Call<T> { @Override public T execute() throws IOException, ApiError { Response response = rawCall.execute(); return adapt(response); } OkHttpCall(okhttp3.Call rawCall, ResponseAdapter<T> adapter); @Override T execute(); @Override void enqueue(final Callback<T> callback); @Override boolean isExecuted(); @Override void cancel(); @Override boolean isCanceled(); @SuppressWarnings("CloneDoesntCallSuperClone") @Override OkHttpCall<T> clone();  }