@Test public void http_429_throw_qos_throttle() throws IOException { when(call.execute()).thenReturn(Response.error(429, NO_CONTENT_RESPONSE_BODY)); CallAdapter<Void, Void> adapter = (CallAdapter<Void, Void>) factory.get(type, NO_ANNOTATIONS, retrofit); adapter.adapt(call); assertThatThrownBy(() -> argument.getValue().execute()) .isInstanceOfSatisfying(QosException.Throttle.class, e -> assertThat(e.getRetryAfter()) .isEmpty()); }
@Nullable @Override public CallAdapter<?, ?> get(Type returnType, Annotation[] annotations, Retrofit retrofit) { CallAdapter<?, ?> adapter = delegate.get(returnType, annotations, retrofit); return new QosExceptionThrowingCallAdapter<>(adapter); }
QosExceptionThrowingCallAdapterFactory extends CallAdapter.Factory { @Nullable @Override public CallAdapter<?, ?> get(Type returnType, Annotation[] annotations, Retrofit retrofit) { CallAdapter<?, ?> adapter = delegate.get(returnType, annotations, retrofit); return new QosExceptionThrowingCallAdapter<>(adapter); } }
QosExceptionThrowingCallAdapterFactory extends CallAdapter.Factory { @Nullable @Override public CallAdapter<?, ?> get(Type returnType, Annotation[] annotations, Retrofit retrofit) { CallAdapter<?, ?> adapter = delegate.get(returnType, annotations, retrofit); return new QosExceptionThrowingCallAdapter<>(adapter); } QosExceptionThrowingCallAdapterFactory(CallAdapter.Factory delegate); }
QosExceptionThrowingCallAdapterFactory extends CallAdapter.Factory { @Nullable @Override public CallAdapter<?, ?> get(Type returnType, Annotation[] annotations, Retrofit retrofit) { CallAdapter<?, ?> adapter = delegate.get(returnType, annotations, retrofit); return new QosExceptionThrowingCallAdapter<>(adapter); } QosExceptionThrowingCallAdapterFactory(CallAdapter.Factory delegate); @Nullable @Override CallAdapter<?, ?> get(Type returnType, Annotation[] annotations, Retrofit retrofit); }
QosExceptionThrowingCallAdapterFactory extends CallAdapter.Factory { @Nullable @Override public CallAdapter<?, ?> get(Type returnType, Annotation[] annotations, Retrofit retrofit) { CallAdapter<?, ?> adapter = delegate.get(returnType, annotations, retrofit); return new QosExceptionThrowingCallAdapter<>(adapter); } QosExceptionThrowingCallAdapterFactory(CallAdapter.Factory delegate); @Nullable @Override CallAdapter<?, ?> get(Type returnType, Annotation[] annotations, Retrofit retrofit);  }