kotest-assertions-core / io.kotest.matchers.date / java.time.LocalTime / shouldNotBeAfter

shouldNotBeAfter

infix fun LocalTime.shouldNotBeAfter(time: LocalTime): Unit

Asserts that this is NOT after time

Verifies that this is not after time, comparing hours, minutes, seconds, nanos. For example, 12:30:59:2222 is not after 12:30:59:3333, and this assertion should pass for this comparison.

Opposite of LocalTime.shouldBeAfter

    val firstTime = LocalTime.of(12:30:59:2222)
    val secondTime = LocalTime.of(12:30:59:3333)

    firstTime shouldNotBeAfter secondTime   // Assertion passes


    val firstTime = LocalTime.of(12:30:59:2222)
    val secondTime = LocalTime.of(12:30:59:1111)

    firstTime shouldNotBeAfter secondTime   // Assertion fails, first time IS after secondTime

See Also

LocalTime.shouldBeBefore