@Test public void enqueue_Throws_WithNullArgument() throws Exception { expectedException.expect(IllegalArgumentException.class); testCall.enqueue(null); }
@Override public void enqueue(final Callback<T> callback) { if (callback == null) { throw new IllegalArgumentException("Callback argument cannot be null."); } delegate.enqueue(new Callback<T>() { @Override public void onResponse(Call<T> call, final T response) { callbackExecutor.execute(new Runnable() { @Override public void run() { callback.onResponse(ScheduledCall.this, response); } }); } @Override public void onFailure(Call<T> call, final Throwable t) { callbackExecutor.execute(new Runnable() { @Override public void run() { callback.onFailure(ScheduledCall.this, t); } }); } }); }
ScheduledCall implements Call<T> { @Override public void enqueue(final Callback<T> callback) { if (callback == null) { throw new IllegalArgumentException("Callback argument cannot be null."); } delegate.enqueue(new Callback<T>() { @Override public void onResponse(Call<T> call, final T response) { callbackExecutor.execute(new Runnable() { @Override public void run() { callback.onResponse(ScheduledCall.this, response); } }); } @Override public void onFailure(Call<T> call, final Throwable t) { callbackExecutor.execute(new Runnable() { @Override public void run() { callback.onFailure(ScheduledCall.this, t); } }); } }); } }
ScheduledCall implements Call<T> { @Override public void enqueue(final Callback<T> callback) { if (callback == null) { throw new IllegalArgumentException("Callback argument cannot be null."); } delegate.enqueue(new Callback<T>() { @Override public void onResponse(Call<T> call, final T response) { callbackExecutor.execute(new Runnable() { @Override public void run() { callback.onResponse(ScheduledCall.this, response); } }); } @Override public void onFailure(Call<T> call, final Throwable t) { callbackExecutor.execute(new Runnable() { @Override public void run() { callback.onFailure(ScheduledCall.this, t); } }); } }); } ScheduledCall(Call<T> delegate, Executor callbackExecutor); }
ScheduledCall implements Call<T> { @Override public void enqueue(final Callback<T> callback) { if (callback == null) { throw new IllegalArgumentException("Callback argument cannot be null."); } delegate.enqueue(new Callback<T>() { @Override public void onResponse(Call<T> call, final T response) { callbackExecutor.execute(new Runnable() { @Override public void run() { callback.onResponse(ScheduledCall.this, response); } }); } @Override public void onFailure(Call<T> call, final Throwable t) { callbackExecutor.execute(new Runnable() { @Override public void run() { callback.onFailure(ScheduledCall.this, t); } }); } }); } ScheduledCall(Call<T> delegate, Executor callbackExecutor); @Override T execute(); @Override void enqueue(final Callback<T> callback); @Override boolean isExecuted(); @Override void cancel(); @Override boolean isCanceled(); @SuppressWarnings("CloneDoesntCallSuperClone") // Performing deep clone. @Override ScheduledCall<T> clone(); }
ScheduledCall implements Call<T> { @Override public void enqueue(final Callback<T> callback) { if (callback == null) { throw new IllegalArgumentException("Callback argument cannot be null."); } delegate.enqueue(new Callback<T>() { @Override public void onResponse(Call<T> call, final T response) { callbackExecutor.execute(new Runnable() { @Override public void run() { callback.onResponse(ScheduledCall.this, response); } }); } @Override public void onFailure(Call<T> call, final Throwable t) { callbackExecutor.execute(new Runnable() { @Override public void run() { callback.onFailure(ScheduledCall.this, t); } }); } }); } ScheduledCall(Call<T> delegate, Executor callbackExecutor); @Override T execute(); @Override void enqueue(final Callback<T> callback); @Override boolean isExecuted(); @Override void cancel(); @Override boolean isCanceled(); @SuppressWarnings("CloneDoesntCallSuperClone") // Performing deep clone. @Override ScheduledCall<T> clone();  }