assertj: CompletionStage asserts about failed state should fail when not Done, and only join() else

hasFailed() assertion currently passes when the Future/CompletionStage is not yet done, causing brittle tests and race conditions. hasFailedWithThrowableThat() on the other hand joins, so it’s also an inconsistency. hasFailedWithThrowableThat() should only join() when done. joining else may cause infinitely running tests, which is undesirable even if it’s the original test cases fault.

  • hasFailed() should fail when not done.
  • hasNotFailed() should fail when not done.
  • hasFailedWithThrowableThat() should only join() when done.

Discussed in #1010

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (17 by maintainers)

Commits related to this issue

Most upvoted comments

I need to think about this one to make that it follows the semantics of the CompletionStage