Skip to content

Commit bd6ec02

Browse files
committed
fixup! STF-322: Add tests for transport-failure retry
1 parent cb92a04 commit bd6ec02

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

src/test/java/com/maxmind/geoip2/WebServiceClientTest.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)