fun LocalDate.shouldBeBetween(a: LocalDate, b: LocalDate): Unit
Asserts that this is between a and b
Verifies that this is after a and before b, comparing year, month and day.
Opposite of LocalDate.shouldNotBeBetween
val date = LocalDate.of(2019, 2, 16)
val firstDate = LocalDate.of(2019, 2, 15)
val secondDate = LocalDate.of(2019, 2, 17)
date.shouldBeBetween(firstDate, secondDate) // Assertion passes
val date = LocalDate.of(2019, 2, 15)
val firstDate = LocalDate.of(2019, 2, 16)
val secondDate = LocalDate.of(2019, 2, 17)
date.shouldBeBetween(firstDate, secondDate) // Assertion fails, date is NOT between firstDate and secondDate
See Also