30
30
31
31
import com .google .auth .Credentials ;
32
32
import com .google .auth .RequestMetadataCallback ;
33
- import com .google .auth .Retryable ;
34
33
import com .google .auth .http .HttpTransportFactory ;
35
34
import com .google .auth .oauth2 .AccessToken ;
36
35
import com .google .auth .oauth2 .GoogleCredentials ;
@@ -192,9 +191,8 @@ public void invalidBase64() throws Exception {
192
191
}
193
192
194
193
@ Test
195
- public void credentialsFailsWithRetryableRetryableException () throws Exception {
196
- boolean retryable = true ;
197
- Exception exception = new RetryableException (retryable );
194
+ public void credentialsFailsWithIoException () throws Exception {
195
+ Exception exception = new IOException ("Broken" );
198
196
when (credentials .getRequestMetadata (eq (expectedUri ))).thenThrow (exception );
199
197
200
198
GoogleAuthLibraryCallCredentials callCredentials =
@@ -208,23 +206,6 @@ public void credentialsFailsWithRetryableRetryableException() throws Exception {
208
206
assertEquals (exception , status .getCause ());
209
207
}
210
208
211
- @ Test
212
- public void credentialsFailsWithUnretryableRetryableException () throws Exception {
213
- boolean retryable = false ;
214
- Exception exception = new RetryableException (retryable );
215
- when (credentials .getRequestMetadata (eq (expectedUri ))).thenThrow (exception );
216
-
217
- GoogleAuthLibraryCallCredentials callCredentials =
218
- new GoogleAuthLibraryCallCredentials (credentials );
219
- callCredentials .applyRequestMetadata (new RequestInfoImpl (), executor , applier );
220
-
221
- verify (credentials ).getRequestMetadata (eq (expectedUri ));
222
- verify (applier ).fail (statusCaptor .capture ());
223
- Status status = statusCaptor .getValue ();
224
- assertEquals (Status .Code .UNAUTHENTICATED , status .getCode ());
225
- assertEquals (exception , status .getCause ());
226
- }
227
-
228
209
@ Test
229
210
public void credentialsFailsWithRuntimeException () throws Exception {
230
211
Exception exception = new RuntimeException ("Broken" );
@@ -472,21 +453,4 @@ public Attributes getTransportAttrs() {
472
453
return Attributes .EMPTY ;
473
454
}
474
455
}
475
-
476
- private static class RetryableException extends IOException implements Retryable {
477
- private final boolean retryable ;
478
-
479
- public RetryableException (boolean retryable ) {
480
- super ("Broken" );
481
- this .retryable = retryable ;
482
- }
483
-
484
- @ Override public boolean isRetryable () {
485
- return retryable ;
486
- }
487
-
488
- @ Override public int getRetryCount () {
489
- return 0 ;
490
- }
491
- }
492
456
}
0 commit comments