Make Failure Boring with Mocks
Blog post from Speedscale
Part three of a ten-part series explains how dependency seams make failure and retry behavior testable in a package notifier without relying on a real carrier service or real time delays. By injecting both a shipment-status lookup and a sleep function, tests can simulate carrier refusals, timeouts, unknown status values, temporary recovery, and permanent failure while verifying retry counts and backoff calls quickly. The examples in Java, Node.js, Go, and Python emphasize using named errors rather than message strings and treating unknown statuses as an explicit product decision rather than an accidental crash. These unit tests establish that failures surface appropriately, recoverable errors trigger retries, and retry budgets eventually stop, but they do not validate whether simulated failures accurately match real carrier behavior or whether the configured retry policy is appropriate. Future installments will test a real HTTP client against a fake server and address the risk that invented test failures diverge from production conditions.
| Trend | Post Mentions | Total Month Mentions | Posts | Companies | MoM |
|---|---|---|---|---|---|
| Real-time | 2 | 649 | 155 | 80 | -85% |
Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.