# java.lang.InterruptedException: sleep interrupted

- **ID:** `java/mockito-verify-timeout-interrupted`
- **Domain:** java
- **Category:** system_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

verify with timeout uses a background thread that gets interrupted, often due to test timeout or thread issues.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 8+ | active | — | — |

## Workarounds

1. **Increase test timeout to accommodate verify timeout** (85% success)
   ```
   @Timeout(10)
@Test
void asyncTest() {
    verify(mock, timeout(5000)).method();
}
   ```
2. **Use awaitility library for async tests** (90% success)
   ```
   await().atMost(5, SECONDS).untilAsserted(() -> {
    verify(mock).method();
});
   ```

## Dead Ends

- **Removing timeout from verify** — May cause test to hang indefinitely. (60% fail)
- **Catching InterruptedException and ignoring** — Hides real threading issues; test may pass incorrectly. (50% fail)
