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

shouldNotHaveSameNanosAs

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

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

Verifies that nanos in this time aren't the same as time's nanos, ignoring any other fields. For example, 16:59:05:2222 doesn't have the same nanos as 16:59:05:1111, and this assertion should pass for this comparison

Opposite of LocalTime.shouldHaveSameNanosAs

    val firstTime = LocalTime.of(22, 59, 30, 1000)
    val secondTime = LocalTime.of(22, 59, 30, 3333)

    firstTime shouldNotHaveSameNanosAs secondTime   //  Assertion passes


    val firstTime = LocalTime.of(23, 40, 30, 1000)
    val secondTime = LocalTime.of(12, 17, 59, 1000)

    firstTime shouldNotHaveSameNanosAs secondTime   //  Assertion fails, 1000 == 1000