public class DefaultComparator extends AbstractComparator
JSONCompareMode that is passed as constructor's argument.| Constructor and Description |
|---|
DefaultComparator(JSONCompareMode mode) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
areNotSameDoubles(Object expectedValue,
Object actualValue) |
protected boolean |
areNumbers(Object expectedValue,
Object actualValue) |
void |
compareJSON(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. |
void |
compareJSONArray(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(String prefix,
Object expectedValue,
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. |
checkJsonObjectKeysActualInExpected, checkJsonObjectKeysExpectedInActual, compareJSON, compareJSON, compareJSONArrayOfJsonObjects, compareJSONArrayOfSimpleValues, compareJSONArrayWithStrictOrder, recursivelyCompareJSONArraypublic DefaultComparator(JSONCompareMode mode)
public void compareJSON(String prefix, org.json.JSONObject expected, org.json.JSONObject actual, JSONCompareResult result) throws org.json.JSONException
JSONComparatorJSONObjects on the provided path represented by prefix and
updates the result of the comparison in the result JSONCompareResult object.prefix - the path in the json where the comparison happensexpected - the expected JSON objectactual - the actual JSON objectresult - stores the actual state of the comparison resultorg.json.JSONException - JSON parsing errorpublic void compareValues(String prefix, Object expectedValue, Object actualValue, JSONCompareResult result) throws org.json.JSONException
JSONComparatorObjects on the provided path represented by prefix and
updates the result of the comparison in the result JSONCompareResult object.prefix - the path in the json where the comparison happensexpectedValue - the expected valueactualValue - the actual valueresult - stores the actual state of the comparison resultorg.json.JSONException - JSON parsing errorpublic void compareJSONArray(String prefix, org.json.JSONArray expected, org.json.JSONArray actual, JSONCompareResult result) throws org.json.JSONException
JSONComparatorJSONArrays on the provided path represented by prefix and
updates the result of the comparison in the result JSONCompareResult object.prefix - the path in the json where the comparison happensexpected - the expected JSON arrayactual - the actual JSON arrayresult - stores the actual state of the comparison resultorg.json.JSONException - JSON parsing errorCopyright © 2023. All rights reserved.