test(circuit-breaker): verify open circuit does not call the service · iluwatar/java-design-patterns@5085a97 · GitHub
Skip to content

Commit 5085a97

Browse files
test(circuit-breaker): verify open circuit does not call the service
- Add a test with a call-counting service: once the circuit is open, attemptRequest() must return the cached failure without calling the service again. Previously a fallback and a real failing call returned the same string, so ignoring the OPEN state went undetected. - testEvaluateState computed "a failure long ago" with int arithmetic (1000 * 1000 * 1000 * 1000 overflows to -727379968), which placed the failure in the future. Use long literals and assert OPEN within the retry period and HALF_OPEN after it.
1 parent 4cabb20 commit 5085a97

1 file changed

Lines changed: 29 additions & 6 deletions

File tree

‎circuit-breaker/src/test/java/com/iluwatar/circuitbreaker/DefaultCircuitBreakerTest.java‎

Lines changed: 29 additions & 6 deletions

0 commit comments

Comments
 (0)