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

shouldNotBeBefore

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

Asserts that this is NOT before date

Verifies that this is not before date, comparing year, month and day. For example, 10/02/1998 is not before 09/02/1998, and this assertion should pass for this comparison.

Opposite of LocalDate.shouldBeBefore

    val firstDate = LocalDate.of(1998, 2, 10)
    val secondDate = LocalDate.of(1998, 2, 9)

    firstDate shouldNotBeBefore secondDate    // Assertion passes



    val firstDate = LocalDate.of(1998, 2, 9)
    val secondDate = LocalDate.of(1998, 2, 10)

    firstDate shouldNotBeBefore secondDate     // Assertion fails, 09/02/1998 is before 10/02/1998, and we expected the opposite.

See Also

LocalDate.shouldBeAfter