Skip to content

Commit de1b84c

Browse files
committed
Clear interrupted status of a thread in test
`RetryWithDelayTest#throwsWhenSleepInterrupted()` test mocks throwing of `InterruptedException` and triggers handling code to restore the interrupted status. This caused some subsequent tests to fail because they still saw current thread as being interrupted. This commit adds clearing of the interrupted status to the test.
1 parent 2b565b7 commit de1b84c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

driver/src/test/java/org/neo4j/driver/internal/retry/RetryWithDelayTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ public void throwsWhenSleepInterrupted() throws Exception
152152
assertThat( e, instanceOf( IllegalStateException.class ) );
153153
assertThat( e.getCause(), instanceOf( InterruptedException.class ) );
154154
}
155+
finally
156+
{
157+
// Clear the interruption flag so all subsequent tests do not see this thread as interrupted
158+
Thread.interrupted();
159+
}
155160
}
156161

157162
private static RetryWithDelay newRetryWithDelay( int maxAttempts, long delayMs, Clock clock )

0 commit comments

Comments
 (0)