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

shouldBeAfter

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

Asserts that this is after time

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

Opposite of LocalTime.shouldNotBeAfter

    val firstTime = LocalTime.of(12, 30, 59, 1111)
    val secondTime = LocalTime.of(11, 30, 59, 1111)

    firstTime shouldBeAfter secondTime  // Assertion passes


    val firstTime = LocalTime.of(12, 30, 59, 1111)
    val secondTime = LocalTime.of(12, 50, 59, 1111)

    firstTime shouldBeAfter secondTime  // Assertion fails, firstTime is NOT after secondTime

See Also

LocalTime.shouldNotBeBefore