Interface JSONComparator

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void compareJSON​(java.lang.String prefix, org.json.JSONObject expected, org.json.JSONObject actual, JSONCompareResult result)
      Compares two JSONObjects on the provided path represented by prefix and updates the result of the comparison in the result JSONCompareResult object.
      JSONCompareResult compareJSON​(org.json.JSONArray expected, org.json.JSONArray actual)
      Compares two JSONArrays and returns the result of the comparison in a JSONCompareResult object.
      JSONCompareResult compareJSON​(org.json.JSONObject expected, org.json.JSONObject actual)
      Compares two JSONObjects and returns the result of the comparison in a JSONCompareResult object.
      void compareJSONArray​(java.lang.String prefix, org.json.JSONArray expected, org.json.JSONArray actual, JSONCompareResult result)
      Compares two JSONArrays on the provided path represented by prefix and updates the result of the comparison in the result JSONCompareResult object.
      void compareValues​(java.lang.String prefix, java.lang.Object expectedValue, java.lang.Object actualValue, JSONCompareResult result)
      Compares two Objects on the provided path represented by prefix and updates the result of the comparison in the result JSONCompareResult object.
    • 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​(java.lang.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​(java.lang.String prefix,
                           java.lang.Object expectedValue,
                           java.lang.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​(java.lang.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