kotest-assertions / io.kotest.matchers.date / shouldNotBeAfter

shouldNotBeAfter

infix fun <ERROR CLASS>.shouldNotBeAfter(other: <ERROR CLASS>): <ERROR CLASS>

Asserts that this is NOT after other

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

Opposite of Date.shouldBeAfter

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

    firstDate shouldNotBeAfter secondDate   // Assertion passes


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

    firstDate shouldNotBeAfter secondDate   // Assertion fails, first date IS after secondDate

See Also

Date.shouldBeBefore