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

shouldNotHaveSameHoursAs

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

Asserts that hours in this time are NOT the same as time's hours

Verifies that hours in this time aren't the same as time's hours, ignoring any other fields. For example, 16:59:59:7777 doesn't have the same hours as 16:01:02:0001, and this assertion should pass for this comparison

Opposite of LocalTime.shouldNotHaveSameHoursAs

    val firstTime = LocalTime.of(23, 59, 30, 1000)
    val secondTime = LocalTime.of(20, 59, 30, 1000)

    firstTime shouldNotHaveSameHoursAs secondTime   //  Assertion passes


    val firstTime = LocalTime.of(23, 59, 30, 1000)
    val secondTime = LocalTime.of(23, 30, 25, 2222)

    firstTime shouldNotHaveSameHoursAs secondTime   //  Assertion fails, 23 == 23