File tree Expand file tree Collapse file tree
src/test/java/com/maxmind/geoip2 Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -682,10 +682,17 @@ public void testRetriesExhausted() {
682682
683683 // 1 initial attempt + 2 retries.
684684 wireMock .verify (3 , getRequestedFor (urlEqualTo (url )));
685- // The final exception should carry the prior failures as suppressed
686- // exceptions so the full retry history is visible in stack traces.
687- assertEquals (2 , ex .getSuppressed ().length ,
688- "expected the 2 prior IOExceptions to be attached as suppressed" );
685+ // The full retry history is reachable via the suppressed chain: each
686+ // exception carries its immediate predecessor as a suppressed
687+ // exception. Walk the chain and confirm we have 2 priors.
688+ int priorCount = 0 ;
689+ Throwable cur = ex ;
690+ while (cur .getSuppressed ().length > 0 ) {
691+ cur = cur .getSuppressed ()[0 ];
692+ priorCount ++;
693+ }
694+ assertEquals (2 , priorCount ,
695+ "expected the 2 prior IOExceptions in the suppressed chain" );
689696 }
690697
691698 @ Test
You can’t perform that action at this time.
0 commit comments