fun OffsetDateTime.shouldBeWithin(temporalAmount: TemporalAmount, date: OffsetDateTime): Unit
Asserts that this is within temporalAmount of date
Verifies that this is within temporalAmount of date. For example, 09/02/1998 10:00:00 -03:00 is within 3 days of 10/02/1998 10:00:00 -03:00, and this assertion should pass for this comparison.
Opposite of OffsetDateTime.shouldNotBeWithin
val firstDate = OffsetDateTime.of(1998, 2, 9, 10, 0, 0, 0, ZoneOffset.ofHours(-3)
val secondDate = OffsetDateTime.of(1998, 2, 10, 10, 0, 0, 0, ZoneOffset.ofHours(-3))
firstDate.shouldBeWithin(Period.ofDays(3), secondDate) // Assertion passes
val firstDate = OffsetDateTime.of(1998, 2, 9, 10, 0, 0, 0, ZoneOffset.ofHours(-3))
val secondDate = OffsetDateTime.of(1998, 2, 25, 10, 0, 0, 0, ZoneOffset.ofHours(-3))
firstDate.shouldBeWithin(Period.ofDays(3), secondDate) // Assertion fails, firstDate is not within 3 days of secondDate