Skip to content

Commit e1bca4b

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

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -583,10 +583,17 @@ public void testRetriesExhausted() {
583583

584584
// 1 initial attempt + 2 retries.
585585
wireMock.verify(3, postRequestedFor(urlEqualTo(url)));
586-
// The final exception should carry the prior failures as suppressed
587-
// exceptions so the full retry history is visible in stack traces.
588-
assertEquals(2, ex.getSuppressed().length,
589-
"expected the 2 prior IOExceptions to be attached as suppressed");
586+
// The full retry history is reachable via the suppressed chain: each
587+
// exception carries its immediate predecessor as a suppressed
588+
// exception. Walk the chain and confirm we have 2 priors.
589+
int priorCount = 0;
590+
Throwable cur = ex;
591+
while (cur.getSuppressed().length > 0) {
592+
cur = cur.getSuppressed()[0];
593+
priorCount++;
594+
}
595+
assertEquals(2, priorCount,
596+
"expected the 2 prior IOExceptions in the suppressed chain");
590597
}
591598

592599
@Test

0 commit comments

Comments
 (0)