-
-
Notifications
You must be signed in to change notification settings - Fork 765
Closed
Milestone
Description
Describe the bug
Sometimes I need to verify that the future completed with exception, but don't care with which exactly.
Used assertThat(future).failsWithin(...) for that. But, to my greatest surprise, found that assertThat(future).failsWithin(...) passes when the future doesn't complete at all, neither successfully, nor exceptionally.
- assertj core version: 3.26.3
- java version: 17
- test framework version: junit 5
Test case reproducing the bug
// a future that doesn't complete
CompletableFuture<Void> future = new CompletableFuture<>();
// the next assertion passes as if future has failed --- this is counterintuitive
assertThat(future).failsWithin(Duration.ofMillis(100));
// the next assertion fails, because the future hasn't actually failed --- this makes sense
assertThat(future).hasFailed();