Skip to content

Instantly share code, notes, and snippets.

Created November 4, 2022 10:54
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
package org.example.repositories;
import com.fasterxml.jackson.databind.JsonNode;
import io.restassured.response.Response;
import org.json.JSONException;
import org.skyscreamer.jsonassert.JSONAssert;
import org.skyscreamer.jsonassert.JSONCompareMode;
import org.springframework.stereotype.Repository;
public class ResponseUtils {
public static void assertJson(String actualJson, String expectedJson, JSONCompareMode mode) throws JSONException {
JSONAssert.assertEquals(expectedJson, actualJson, mode);
public static void assertJson(Response response, JsonNode expectedJson) throws JSONException {
assertJson(response.getBody().asString(), expectedJson.toString(), JSONCompareMode.LENIENT);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment