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

beToday

fun beToday(): Matcher<LocalDate>

Matcher that checks if a LocalDate is 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 = LocalDate.now()

    date should beToday() // Assertion passes


    val date = LocalDate.of(2018,1,1)

    date should beToday() // Assertion fails