Currently there are no isCloseTo assertions for LocalDate and LocalDateTime like _org.assertj.core.api.AbstractDateAssert.isCloseTo_, but they would obviously be useful.
This could be implemented by giving the delta either in days/milliseconds or by allowing a TimeUnit / Period / Duration parameter.
assertThat( LocalDate.of(1900, 1, 1) ).isCloseTo( LocalDate.of(1900, 1, 2), 1); // delta in days
assertThat( LocalDateTime.of(1900, 1, 1, 0, 0) ).isCloseTo( LocalDateTime.of(1900, 1, 1,0,1), 1000*60); // delta in ms
// or perhaps...
assertThat( LocalDate.of(1900, 1, 1)).isCloseTo( LocalDate.of(1900, 1, 2), 1, TimeUnit.DAYS);
assertThat( LocalDateTime.of(1900, 1, 1, 0, 0)).isCloseTo( LocalDateTime.of(1900, 1, 1,0,1), 1, TimeUnit.MINUTES);
// or perhaps...
assertThat( LocalDate.of(1900, 1, 1)).isCloseTo( LocalDate.of(1900, 1, 2), Period.ofDays(1) );
assertThat( LocalDateTime.of(1900, 1, 1, 0, 0)).isCloseTo( LocalDateTime.of(1900, 1, 1,0,1), Duration.ofMinutes( 1) );
master branchIt looks like this one is already implemented (#796) and will be part of the next release.
Thanks @epeee, you know the project better than me :smile_cat: !
@FlorianSchaetz sorry to have asked you to fill this issue which is already there.
Most helpful comment
It looks like this one is already implemented (#796) and will be part of the next release.