@@ -234,25 +234,34 @@ void isRetryableException() {
234
234
assertThat (retrier .shouldRetryOnException (new HttpRetryException ("timeout retry" , 400 )))
235
235
.isTrue ();
236
236
}
237
+
237
238
@ Test
238
239
void isRetryableExceptionDefaultBehaviour () {
239
- RetryInterceptor retryInterceptor = new RetryInterceptor (RetryPolicy .getDefault (),
240
- OkHttpHttpSender ::isRetryable );
241
- assertThat (retryInterceptor
242
- .shouldRetryOnException (new SocketTimeoutException ("Connect timed out" ))).isTrue ();
240
+ RetryInterceptor retryInterceptor =
241
+ new RetryInterceptor (RetryPolicy .getDefault (), OkHttpHttpSender ::isRetryable );
242
+ assertThat (
243
+ retryInterceptor .shouldRetryOnException (
244
+ new SocketTimeoutException ("Connect timed out" )))
245
+ .isTrue ();
243
246
assertThat (retryInterceptor .shouldRetryOnException (new IOException ("Connect timed out" )))
244
247
.isFalse ();
245
248
}
249
+
246
250
@ Test
247
251
void isRetryableExceptionCustomRetryPredicate () {
248
- RetryInterceptor retryInterceptor = new RetryInterceptor (RetryPolicy .builder ()
249
- .setRetryExceptionPredicate ((IOException e ) -> e .getMessage ().equals ("retry" )).build (),
250
- OkHttpHttpSender ::isRetryable );
252
+ RetryInterceptor retryInterceptor =
253
+ new RetryInterceptor (
254
+ RetryPolicy .builder ()
255
+ .setRetryExceptionPredicate ((IOException e ) -> e .getMessage ().equals ("retry" ))
256
+ .build (),
257
+ OkHttpHttpSender ::isRetryable );
251
258
252
259
assertThat (retryInterceptor .shouldRetryOnException (new IOException ("some message" ))).isFalse ();
253
260
assertThat (retryInterceptor .shouldRetryOnException (new IOException ("retry" ))).isTrue ();
254
- assertThat (retryInterceptor
255
- .shouldRetryOnException (new SocketTimeoutException ("Connect timed out" ))).isTrue ();
261
+ assertThat (
262
+ retryInterceptor .shouldRetryOnException (
263
+ new SocketTimeoutException ("Connect timed out" )))
264
+ .isTrue ();
256
265
}
257
266
258
267
private Response sendRequest () throws IOException {
0 commit comments