java-hamcrest
java-hamcrest copied to clipboard
Allow future asserts to be interrupted.
Hamcrest enters matching method twice, first time to match value and second time to compose description.
When using JUnit5 @Timeout annotation or other ways to interrupt a thread, it will interrupt thread only once, so second entry will block on future indefinitely.
This PR restores thread interrupted state, so that second entry will not block and timeout could be effectively executed.
Possible issue: considering that we are working with futures, a state of non-complete future can change between matching value and matching description invocations. Saving state in the matcher has to be done on per-future basis to make matcher reusable between different future.