EasyOkCallback implements Callback { public abstract void failure(Throwable t); EasyOkCallback(); abstract void success(@NonNull Response response); abstract void failure(Throwable t); EasyOkCallback allowNullBodies(boolean allowNullBodies); EasyOkCallback executor(Executor executor); EasyOkCallback successExecutor(Executor executor); EasyOkCallback failureExecutor(Executor executor); @Override void onResponse(Call call, Response response); @Override void onFailure(Call call, IOException e); @NonNull Call call();  }
@Test public void testFailure() throws Exception { Request request = new Request.Builder() .url("https: .build(); client.newCall(request).enqueue(new EasyOkCallback() { @Override public void success(@NonNull Response response) { Assert.fail("call should have failed"); } @Override public void failure(Throwable t) { } }); }