Liftwizard includes utilities for asserting that a JSON string equals the contents of a file using JSON equality semantics Liftwizard delegates to JSONassert for JSON comparison The API is similar to the file matching API and re record mode is enabled with the same environment variable The setup is different for the JUnit 4 Rule and JUnit 5 Extension After setup both have the same API If the file does not exist or the contents do not match an assertion error is added to an ErrorCollector If the ErrorCollector contains any errors the test fails at the end with all expected actual pairs reported together If is set to will not emit any JUnit 4 works well with Dropwizard s JsonMatchRule DropwizardAppRule public class ExampleTest @Rule private final DropwizardAppRule<HelloWorldConfiguration> dropwizardAppRule new DropwizardAppRule<> ExampleApplication class ResourceHelpers resourceFilePath config test json5 @Rule public final JsonMatchRule jsonMatchRule new JsonMatchRule this getClass @Test public void smokeTest Response actualResponse this dropwizardAppRule client target http localhost port api example resolveTemplate port this dropwizardAppRule getLocalPort request get String actualJsonResponse actualResponse readEntity String class String expectedResponseClassPathLocation this getClass getSimpleName testName json this jsonMatchRule assertFileContents expectedResponseClassPathLocation actualJsonResponse JUnit 5 works well with Dropwizard s or Liftwizard s JsonMatchExtension DropwizardAppExtension LiftwizardAppExtension public class ExampleTest @RegisterExtension private final LiftwizardAppExtension< > appExtension this getLiftwizardAppExtension @RegisterExtension private final JsonMatchExtension jsonMatchExtension new JsonMatchExtension this getClass @Nonnull @Override private LiftwizardAppExtension< > getLiftwizardAppExtension return new LiftwizardAppExtension<> ExampleApplication class ResourceHelpers resourceFilePath config test json5 @Test public void smokeTest Response actualResponse this appExtension client target http localhost port api example resolveTemplate port this appExtension getLocalPort request get String actualJsonResponse actualResponse readEntity String class String expectedResponseClassPathLocation this getClass getSimpleName testName json this jsonMatchExtension assertFileContents expectedResponseClassPathLocation actualJsonResponse LIFTWIZARD_FILE_MATCH_RULE_RERECORD this jsonMatchExtension assertFileContents expectedJsonClassPathLocation actualJson LIFTWIZARD_FILE_MATCH_RULE_RERECORD true assertJsonContents AssertionErrors