kotest-assertions-core / io.kotest.matchers.date / java.time.ZonedDateTime / shouldNotBeBefore

shouldNotBeBefore

infix fun ZonedDateTime.shouldNotBeBefore(date: ZonedDateTime): Unit

Asserts that this is NOT before date

Verifies that this is not before date, comparing every field in the ZonedDateTime. For example, 09/02/1998 00:00:01 -03:00 America/Sao_Paulo is not before 09/02/1998 00:00:00 -03:00 America/Sao_Paulo, and this assertion should pass for this comparison.

Opposite of ZonedDateTime.shouldBeBefore

    val firstDate = ZonedDateTime.of(1998, 2, 9, 0, 0, 1, 0, ZoneId.of("America/Sao_Paulo"))
    val secondDate = ZonedDateTime.of(1998, 2, 9, 0, 0, 0, 0, ZoneId.of("America/Sao_Paulo"))

    firstDate shouldNotBeBefore secondDate    // Assertion passes


    val firstDate = ZonedDateTime.of(1998, 2, 9, 0, 0, 0, 0, ZoneId.of("America/Sao_Paulo"))
    val secondDate = ZonedDateTime.of(1998, 2, 9, 0, 0, 1, 0, ZoneId.of("America/Sao_Paulo"))

    firstDate shouldNotBeBefore secondDate     // Assertion fails, firstDate is one second before secondDate and we didn't expect it

See Also

ZonedDateTime.shouldBeAfter