DefaultingJsonResponseHandler implements ResponseHandler<T, RuntimeException> { @Override public T handleException(Request request, Exception exception) { return defaultValue; } private  DefaultingJsonResponseHandler(JsonCodec<T> jsonCodec, T defaultValue); private  DefaultingJsonResponseHandler(JsonCodec<T> jsonCodec, T defaultValue, int firstSuccessfulResponseCode, int... otherSuccessfulResponseCodes); static DefaultingJsonResponseHandler<T> createDefaultingJsonResponseHandler(JsonCodec<T> jsonCodec, T defaultValue); static DefaultingJsonResponseHandler<T> createDefaultingJsonResponseHandler(JsonCodec<T> jsonCodec, T defaultValue, int firstSuccessfulResponseCode, int... otherSuccessfulResponseCodes); @Override T handleException(Request request, Exception exception); @Override T handle(Request request, Response response);  }
@Test public void testException() { User response = handler.handleException(null, null); assertSame(response, DEFAULT_VALUE); }