Created
November 4, 2022 10:54
-
-
Save luuizeduardo/a560af2734340b3cfa6befbff05c57a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
@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