Class DefaultComparator

    • Constructor Detail

    • Method Detail

      • compareJSON

        public void compareJSON​(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​(String prefix,
                                  Object expectedValue,
                                  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​(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​(Object expectedValue,
                                     Object actualValue)
      • areNotSameDoubles

        protected boolean areNotSameDoubles​(Object expectedValue,
                                            Object actualValue)