Liftwizard includes utilities for asserting that a JSON string equals the contents of a file, using JSON equality semantics. Liftwizard delegates to https://github.com/skyscreamer/JSONassert JSONassert for JSON comparison.The API is similar to the ./matching-files file matching API, and re-record mode is enabled with the same environment variable LIFTWIZARD_FILE_MATCH_RULE_RERECORD .The setup is different for the JUnit 4 Rule and JUnit 5 Extension. After setup, both have the same API. java this.jsonMatchExtension.assertFileContents(expectedJsonClassPathLocation, actualJson); If the file does not exist, or the contents do not match, an assertion error is added to an https://junit.org/junit4/javadoc/4.12/org/junit/rules/ErrorCollector.html ErrorCollector. If the ErrorCollector contains any errors, the test fails at the end with all expected/actual pairs reported together.If LIFTWIZARD_FILE_MATCH_RULE_RERECORD is set to true , assertJsonContents will not emit any AssertionErrors . JUnit 4 JsonMatchRule works well with Dropwizard's https://www.dropwizard.io/en/release-2.1.x/manual/testing.html#junit-4 DropwizardAppRule . java 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 JsonMatchExtension works well with Dropwizard's https://www.dropwizard.io/en/stable/manual/testing.html#junit-5 DropwizardAppExtension or Liftwizard's LiftwizardAppExtension . java 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); } }