Class JsonChecker


  • public class JsonChecker
    extends Object
    values will be first checked for containing "${json-unit.ignore}" then for equals and finally for regex matches

    JSON object attributes starting with four underscores "____" are optional and allow the oracle string to contain attributes to be checked for value ONLY if it exists in the test JSON

    TODO: check JSONObject as parameter yields unreadable output in serenity output, maybe reintroduce SerenityJSONObject

    • Constructor Detail

      • JsonChecker

        public JsonChecker()
    • Method Detail

      • assertJsonArrayShouldMatchInAnyOrder

        public void assertJsonArrayShouldMatchInAnyOrder​(String json,
                                                         String oracle)
      • assertJsonObjectShouldMatchOrContainInAnyOrder

        public void assertJsonObjectShouldMatchOrContainInAnyOrder​(String jsonStr,
                                                                   String oracleStr,
                                                                   boolean checkExtraAttributes)
      • assertJsonAttributeShouldMatch

        public void assertJsonAttributeShouldMatch​(org.json.JSONObject json,
                                                   String claimName,
                                                   String regex)
      • assertJsonAttributeShouldNotMatch

        public void assertJsonAttributeShouldNotMatch​(org.json.JSONObject json,
                                                      String claimName,
                                                      String regex)