All releases

v3.5.2

Java-time field assertions and date matchers

Full notes

Added

  • BSON-aware date matchers. Added dateAfter, dateBefore, dateAtOrAfter, dateAtOrBefore and dateEqualTo to MongoFieldMatchers. They accept Java-time values directly, support an explicit persistence timezone, and compare at BSON millisecond precision. Tests cover type combinations, strict and inclusive boundaries, DST, invalid values, extreme dates, and plain JUnit seeds plus Spring writes and Extended JSON seeds. Available in bonsai-junit and transitively in bonsai-spring-boot.

Fixed

  • Java-time field assertions. BSON dates now compare with LocalDate, LocalDateTime, Instant, OffsetDateTime and ZonedDateTime at millisecond precision. Local values use the JVM timezone by default; hasField(name, expected, zone) supports mappings that use another timezone. A LocalDate matches only its start-of-day instant. The same equality applies inside lists and through valueEqualTo, in both the plain JUnit and Spring harnesses.