Interface JSONComparator

    • Method Detail

      • compareJSON

        JSONCompareResult compareJSON​(org.json.JSONObject expected,
                                      org.json.JSONObject actual)
                               throws org.json.JSONException
        Compares two JSONObjects and returns the result of the comparison in a JSONCompareResult object.
        Parameters:
        expected - the expected JSON object
        actual - the actual JSON object
        Returns:
        the result of the comparison
        Throws:
        org.json.JSONException - JSON parsing error
      • compareJSON

        JSONCompareResult compareJSON​(org.json.JSONArray expected,
                                      org.json.JSONArray actual)
                               throws org.json.JSONException
        Compares two JSONArrays and returns the result of the comparison in a JSONCompareResult object.
        Parameters:
        expected - the expected JSON array
        actual - the actual JSON array
        Returns:
        the result of the comparison
        Throws:
        org.json.JSONException - JSON parsing error
      • compareJSON

        void compareJSON​(String prefix,
                         org.json.JSONObject expected,
                         org.json.JSONObject actual,
                         JSONCompareResult result)
                  throws org.json.JSONException
        Compares two JSONObjects on the provided path represented by prefix and updates the result of the comparison in the result JSONCompareResult object.
        Parameters:
        prefix - the path in the json where the comparison happens
        expected - the expected JSON object
        actual - the actual JSON object
        result - stores the actual state of the comparison result
        Throws:
        org.json.JSONException - JSON parsing error
      • compareValues

        void compareValues​(String prefix,
                           Object expectedValue,
                           Object actualValue,
                           JSONCompareResult result)
                    throws org.json.JSONException
        Compares two Objects on the provided path represented by prefix and updates the result of the comparison in the result JSONCompareResult object.
        Parameters:
        prefix - the path in the json where the comparison happens
        expectedValue - the expected value
        actualValue - the actual value
        result - stores the actual state of the comparison result
        Throws:
        org.json.JSONException - JSON parsing error
      • compareJSONArray

        void compareJSONArray​(String prefix,
                              org.json.JSONArray expected,
                              org.json.JSONArray actual,
                              JSONCompareResult result)
                       throws org.json.JSONException
        Compares two JSONArrays on the provided path represented by prefix and updates the result of the comparison in the result JSONCompareResult object.
        Parameters:
        prefix - the path in the json where the comparison happens
        expected - the expected JSON array
        actual - the actual JSON array
        result - stores the actual state of the comparison result
        Throws:
        org.json.JSONException - JSON parsing error