kotest-assertions-core / io.kotest.matchers.date / beInToday

beInToday

fun beInToday(): Matcher<LocalDateTime>

Matcher that checks if a LocalDateTime has a Date component of today

It does this by checking it against LocalDate.now(), so if you are not using constant now listeners, using this might fail if test run exactly on a date change.

    val date = LocalDateTime.now()

    date should beInToday() // Assertion passes


    val date = LocalDateTime.of(2018, Month.APRIL, 1, 3, 5)

    date should beInToday() // Assertion fails