Closed skuzzle closed 1 year ago
A better API has been implemented in 1.2.0
. It can be used like this:
snapshot.assertThat(myself)
.as(JsonSnapshot.withDefaultObjectMapper()
.withComparisonRules(rules -> rules
.pathAt("address.city").ignore()
.pathAt("birthdate").mustMatch(Pattern.compile("\\d{4}-\\d{2}-\\d{2}"))))
.matchesSnapshotStructure();
Leaving this ticket open for now to remove the old method in next minor version.
JSONAssert brings some nice options to customize how two objects are being compared. However, the API is a bit awkward and doesn't fit into our fluent/builder style DSL. As such, we should remove the public visibility of the
JSONComparator
class inJsonSnapshot
and provide a nice fluent wrapper around it.