infix fun OffsetDateTime.shouldBeBefore(date: OffsetDateTime): Unit
Asserts that this is before date
Verifies that this is before date, comparing every field in the OffsetDateTime. For example, 09/02/1998 00:00:00 -03:00 is before 09/02/1998 00:00:01 -03:00, and this assertion should pass for this comparison.
Opposite of OffsetDateTime.shouldNotBeBefore
val firstDate = OffsetDateTime.of(1998, 2, 9, 0, 0, 0, 0, ZoneOffset.ofHours(-3))
val secondDate = OffsetDateTime.of(1998, 2, 9, 0, 0, 1, 0, ZoneOffset.ofHours(-3))
firstDate shouldBeBefore secondDate // Assertion passes
val firstDate = OffsetDateTime.of(1998, 2, 9, 0, 0, 1, 0, ZoneOffset.ofHours(-3))
val secondDate = OffsetDateTime.of(1998, 2, 9, 0, 0, 0, 0, ZoneOffset.ofHours(-3))
firstDate shouldBeBefore secondDate // Assertion fails, firstDate is one second after secondDate
See Also