Class DefaultComparator

    • Constructor Detail

    • Method Detail

      • compareJSON

        public void compareJSON​(java.lang.String prefix,
                                org.json.JSONObject expected,
                                org.json.JSONObject actual,
                                JSONCompareResult result)
                         throws org.json.JSONException
        Description copied from interface: JSONComparator
        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

        public void compareValues​(java.lang.String prefix,
                                  java.lang.Object expectedValue,
                                  java.lang.Object actualValue,
                                  JSONCompareResult result)
                           throws org.json.JSONException
        Description copied from interface: JSONComparator
        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

        public void compareJSONArray​(java.lang.String prefix,
                                     org.json.JSONArray expected,
                                     org.json.JSONArray actual,
                                     JSONCompareResult result)
                              throws org.json.JSONException
        Description copied from interface: JSONComparator
        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
      • areNumbers

        protected boolean areNumbers​(java.lang.Object expectedValue,
                                     java.lang.Object actualValue)
      • areNotSameDoubles

        protected boolean areNotSameDoubles​(java.lang.Object expectedValue,
                                            java.lang.Object actualValue)