EasyCallback implements Callback<T> { public EasyCallback<T> allowNullBodies(boolean allowNullBodies) { this.allowNullBodies = allowNullBodies; return this; } EasyCallback(); abstract void success(@NonNull T response); abstract void failure(Throwable t); EasyCallback<T> allowNullBodies(boolean allowNullBodies); EasyCallback<T> executor(Executor executor); EasyCallback<T> successExecutor(Executor executor); EasyCallback<T> failureExecutor(Executor executor); @Override void onResponse(Call<T> call, Response<T> response); @Override void onFailure(Call<T> call, final Throwable t); Response<T> response(); @NonNull Call<T> call();  }
@Test public void testVoidCallback() throws Exception { google.getVoid().enqueue(new EasyCallback<Void>() { @Override public void success(@NonNull Void response) { } @Override public void failure(Throwable t) { Assert.fail("call should have been successful"); } }.allowNullBodies(true)); }