Kotest Klock Matchers
Explains Klock matchers.
Matchers for the Klock library are provided by the kotest-assertions-klock module.
| Matcher | Description |
|---|---|
date.shouldHaveSameYear(otherDate) |
Checks that the date has the same year as the given date. |
date.shouldHaveSameMonth(otherDate) |
Checks that the date has the same month as the given date. |
date.shouldHaveSameDay(otherDate) |
Checks that the date has the same day of month as the given date. |
date.shouldBeBefore(otherDate) |
Checks that the date is before the given date. |
date.shouldBeAfter(otherDate) |
Checks that the date is after the given date. |
date.shouldBeBetween(firstDate, secondDate) |
Checks that the date is between firstDate and secondDate. |
date.shouldHaveYear(year) |
Checks that the date has the correct year. |
date.shouldHaveMonth(month) |
Checks that the date has the correct month. |
date.shouldHaveDay(day) |
Checks that the date has the exact day. |
date.shouldHaveHour(hour) |
Checks that the date has the correct hour. |
date.shouldHaveMinute(Minute) |
Checks that the date has the correct minute. |
date.shouldHaveSecond(second) |
Checks that the date has the correct second. |
time.shouldHaveSameHoursAs(time) |
Checks that the time has the same hour as the given time. |
time.shouldHaveHours(hours) |
Checks that the time has the given hour. |
time.shouldHaveSameMinutesAs(time) |
Checks that the time has the same minute as the given time. |
time.shouldHaveMinutes(minutes) |
Checks that the time has the given minute. |
time.shouldHaveSameSeconds(time) |
Checks that the time has the same second as the given time. |
time.shouldHaveSeconds(seconds) |
Checks that the time has the given second. |
time.shouldHaveSameMillisecondsAs(time) |
Checks that the time has the same millisecond as the given time. |
time.shouldHaveMilliseconds(millis) |
Checks that the time has the given millisecond value. |
time.shouldBeBefore(time) |
Checks that the time is before the given time. |
time.shouldBeAfter(time) |
Checks that the time is after the given time. |
time.shouldBeBetween(time, time) |
Checks that the time is between the two given times. |