1818
1919import io .minio .errors .ErrorResponseException ;
2020import io .minio .errors .InvalidResponseException ;
21+ import io .minio .errors .MinioException ;
2122import java .io .IOException ;
2223import java .io .RandomAccessFile ;
2324import java .net .SocketException ;
@@ -180,7 +181,7 @@ private MockResponse serviceUnavailable503() {
180181 }
181182
182183 @ Test
183- public void testRetryOn500HtmlThenSuccess () throws Exception {
184+ public void testRetryOn500HtmlThenSuccess () throws IOException , MinioException {
184185 try (MockWebServer server = new MockWebServer ()) {
185186 // First request → 500 HTML (non-XML) → retryable
186187 server .enqueue (serverError500Html ());
@@ -198,7 +199,7 @@ public void testRetryOn500HtmlThenSuccess() throws Exception {
198199 }
199200
200201 @ Test
201- public void testRetryOn503ThenSuccess () throws Exception {
202+ public void testRetryOn503ThenSuccess () throws IOException , MinioException {
202203 try (MockWebServer server = new MockWebServer ()) {
203204 server .enqueue (serviceUnavailable503 ());
204205 server .enqueue (successResponse ());
@@ -213,7 +214,7 @@ public void testRetryOn503ThenSuccess() throws Exception {
213214 }
214215
215216 @ Test
216- public void testNoRetryOn404 () throws Exception {
217+ public void testNoRetryOn404 () throws IOException , MinioException {
217218 String notFoundXml =
218219 "<?xml version=\" 1.0\" encoding=\" UTF-8\" ?>"
219220 + "<Error><Code>NoSuchBucket</Code><Message>not found</Message>"
@@ -242,7 +243,7 @@ public void testNoRetryOn404() throws Exception {
242243 }
243244
244245 @ Test
245- public void testNoRetryOn403 () throws Exception {
246+ public void testNoRetryOn403 () throws IOException , MinioException {
246247 String accessDeniedXml =
247248 "<?xml version=\" 1.0\" encoding=\" UTF-8\" ?>"
248249 + "<Error><Code>AccessDenied</Code><Message>Access Denied</Message>"
@@ -270,7 +271,7 @@ public void testNoRetryOn403() throws Exception {
270271 }
271272
272273 @ Test
273- public void testRetryExhaustedThrowsLastError () throws Exception {
274+ public void testRetryExhaustedThrowsLastError () throws IOException , MinioException {
274275 try (MockWebServer server = new MockWebServer ()) {
275276 // All 3 attempts fail with 500
276277 server .enqueue (serverError500Html ());
@@ -291,7 +292,7 @@ public void testRetryExhaustedThrowsLastError() throws Exception {
291292 }
292293
293294 @ Test
294- public void testMaxRetriesOneDisablesRetry () throws Exception {
295+ public void testMaxRetriesOneDisablesRetry () throws IOException , MinioException {
295296 try (MockWebServer server = new MockWebServer ()) {
296297 server .enqueue (serverError500Html ());
297298 // Second response should never be reached
@@ -312,7 +313,7 @@ public void testMaxRetriesOneDisablesRetry() throws Exception {
312313 }
313314
314315 @ Test
315- public void testSetMaxRetriesPostConstruction () throws Exception {
316+ public void testSetMaxRetriesPostConstruction () throws IOException , MinioException {
316317 try (MockWebServer server = new MockWebServer ()) {
317318 // Two failures enqueued, but maxRetries will be set to 1 after construction
318319 server .enqueue (serverError500Html ());
@@ -333,7 +334,7 @@ public void testSetMaxRetriesPostConstruction() throws Exception {
333334 }
334335
335336 @ Test
336- public void testMultipleRetrySucceedsOnThirdAttempt () throws Exception {
337+ public void testMultipleRetrySucceedsOnThirdAttempt () throws IOException , MinioException {
337338 try (MockWebServer server = new MockWebServer ()) {
338339 server .enqueue (serverError500Html ());
339340 server .enqueue (serviceUnavailable503 ());
@@ -349,7 +350,7 @@ public void testMultipleRetrySucceedsOnThirdAttempt() throws Exception {
349350 }
350351
351352 @ Test
352- public void testRetry429ThenSuccess () throws Exception {
353+ public void testRetry429ThenSuccess () throws IOException , MinioException {
353354 try (MockWebServer server = new MockWebServer ()) {
354355 server .enqueue (
355356 new MockResponse ()
@@ -368,7 +369,7 @@ public void testRetry429ThenSuccess() throws Exception {
368369 }
369370
370371 @ Test
371- public void testRetry502ThenSuccess () throws Exception {
372+ public void testRetry502ThenSuccess () throws IOException , MinioException {
372373 try (MockWebServer server = new MockWebServer ()) {
373374 server .enqueue (
374375 new MockResponse ()
@@ -387,7 +388,7 @@ public void testRetry502ThenSuccess() throws Exception {
387388 }
388389
389390 @ Test
390- public void testRetry504ThenSuccess () throws Exception {
391+ public void testRetry504ThenSuccess () throws IOException , MinioException {
391392 try (MockWebServer server = new MockWebServer ()) {
392393 server .enqueue (
393394 new MockResponse ()
@@ -411,13 +412,13 @@ public void testMaxRetriesBuilderValidation() {
411412 }
412413
413414 @ Test (expected = IllegalArgumentException .class )
414- public void testSetMaxRetriesValidation () throws Exception {
415+ public void testSetMaxRetriesValidation () {
415416 MinioClient client = MinioClient .builder ().endpoint ("http://localhost:9000" ).build ();
416417 client .setMaxRetries (0 );
417418 }
418419
419420 @ Test
420- public void testDefaultMaxRetriesIsConfigurable () throws Exception {
421+ public void testDefaultMaxRetriesIsConfigurable () throws IOException , MinioException {
421422 // Use maxRetries=4 to keep test fast (delays ≤ 200+400+800ms ≈ 1.4s max)
422423 int retries = 4 ;
423424 try (MockWebServer server = new MockWebServer ()) {
@@ -436,7 +437,7 @@ public void testDefaultMaxRetriesIsConfigurable() throws Exception {
436437 }
437438
438439 @ Test
439- public void testRequestBodyRetried () throws Exception {
440+ public void testRequestBodyRetried () throws IOException , MinioException {
440441 // Byte array body (seekable) should be retried
441442 try (MockWebServer server = new MockWebServer ()) {
442443 // First putObject fails, second succeeds with ETag
@@ -469,7 +470,8 @@ public void testRequestBodyRetried() throws Exception {
469470 }
470471
471472 @ Test
472- public void testRandomAccessFileBodyRetried () throws Exception {
473+ public void testRandomAccessFileBodyRetried ()
474+ throws IOException , InterruptedException , MinioException {
473475 Path tmpFile = Files .createTempFile ("retry-raf-test" , ".bin" );
474476 try (MockWebServer server = new MockWebServer ()) {
475477 server .enqueue (serverError500Html ());
@@ -511,7 +513,8 @@ public void testRandomAccessFileBodyRetried() throws Exception {
511513 }
512514
513515 @ Test
514- public void testRecordedRequestHeaders () throws Exception {
516+ public void testRecordedRequestHeaders ()
517+ throws IOException , InterruptedException , MinioException {
515518 try (MockWebServer server = new MockWebServer ()) {
516519 server .enqueue (serverError500Html ());
517520 server .enqueue (successResponse ());
0 commit comments