assertj: ZonedDateTime assertions are not consistent and don't expose isBetween
Summary
My test sometimes fails when the asserted value matches the (supposed to be inclusive) upper boundary. The example code fails with the exception:
java.lang.AssertionError: Expecting: <2019-03-04T10:22:45.622Z> to be between: [2019-03-04T10:22:45.622Z[UTC], 2019-03-04T10:22:45.622Z[UTC]]
Example
ZonedDateTime boundary = ZonedDateTime.now();
assertThat(boundary).isBetween(boundary, boundary); // passes
ZonedDateTime actual = boundary.withFixedOffsetZone();
assertThat(actual.isEqual(boundary)).isTrue(); // passes
assertThat(actual).isBetween(boundary, boundary); //fails
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (9 by maintainers)
Commits related to this issue
- Fix usingComparator() for Temporal assertions #1452 — committed to puddlejumpr/assertj-core by deleted user 5 years ago
- Fix usingComparator() for Temporal assertions #1452 — committed to puddlejumpr/assertj-core by deleted user 5 years ago
Bump, I’m having the same problem.
@joel-costigliola This new PR contains the content of the previous one rebased on master, and the changes addressing your review comments.