Class AbstractComparator
- java.lang.Object
-
- org.skyscreamer.jsonassert.comparator.AbstractComparator
-
- All Implemented Interfaces:
JSONComparator
- Direct Known Subclasses:
DefaultComparator
public abstract class AbstractComparator extends java.lang.Object implements JSONComparator
This class provides a skeletal implementation of theJSONComparatorinterface, to minimize the effort required to implement this interface.
-
-
Constructor Summary
Constructors Constructor Description AbstractComparator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckJsonObjectKeysActualInExpected(java.lang.String prefix, org.json.JSONObject expected, org.json.JSONObject actual, JSONCompareResult result)protected voidcheckJsonObjectKeysExpectedInActual(java.lang.String prefix, org.json.JSONObject expected, org.json.JSONObject actual, JSONCompareResult result)JSONCompareResultcompareJSON(org.json.JSONArray expected, org.json.JSONArray actual)Compares JSONArray provided to the expected JSONArray, and returns the results of the comparison.JSONCompareResultcompareJSON(org.json.JSONObject expected, org.json.JSONObject actual)Compares JSONObject provided to the expected JSONObject, and returns the results of the comparison.protected voidcompareJSONArrayOfJsonObjects(java.lang.String key, org.json.JSONArray expected, org.json.JSONArray actual, JSONCompareResult result)protected voidcompareJSONArrayOfSimpleValues(java.lang.String key, org.json.JSONArray expected, org.json.JSONArray actual, JSONCompareResult result)protected voidcompareJSONArrayWithStrictOrder(java.lang.String key, org.json.JSONArray expected, org.json.JSONArray actual, JSONCompareResult result)protected voidrecursivelyCompareJSONArray(java.lang.String key, org.json.JSONArray expected, org.json.JSONArray actual, JSONCompareResult result)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.skyscreamer.jsonassert.comparator.JSONComparator
compareJSON, compareJSONArray, compareValues
-
-
-
-
Method Detail
-
compareJSON
public final JSONCompareResult compareJSON(org.json.JSONObject expected, org.json.JSONObject actual) throws org.json.JSONException
Compares JSONObject provided to the expected JSONObject, and returns the results of the comparison.- Specified by:
compareJSONin interfaceJSONComparator- Parameters:
expected- Expected JSONObjectactual- JSONObject to compare- Returns:
- the result of the comparison
- Throws:
org.json.JSONException- JSON parsing error
-
compareJSON
public final JSONCompareResult compareJSON(org.json.JSONArray expected, org.json.JSONArray actual) throws org.json.JSONException
Compares JSONArray provided to the expected JSONArray, and returns the results of the comparison.- Specified by:
compareJSONin interfaceJSONComparator- Parameters:
expected- Expected JSONArrayactual- JSONArray to compare- Returns:
- the result of the comparison
- Throws:
org.json.JSONException- JSON parsing error
-
checkJsonObjectKeysActualInExpected
protected void checkJsonObjectKeysActualInExpected(java.lang.String prefix, org.json.JSONObject expected, org.json.JSONObject actual, JSONCompareResult result)
-
checkJsonObjectKeysExpectedInActual
protected void checkJsonObjectKeysExpectedInActual(java.lang.String prefix, org.json.JSONObject expected, org.json.JSONObject actual, JSONCompareResult result) throws org.json.JSONException- Throws:
org.json.JSONException
-
compareJSONArrayOfJsonObjects
protected void compareJSONArrayOfJsonObjects(java.lang.String key, org.json.JSONArray expected, org.json.JSONArray actual, JSONCompareResult result) throws org.json.JSONException- Throws:
org.json.JSONException
-
compareJSONArrayOfSimpleValues
protected void compareJSONArrayOfSimpleValues(java.lang.String key, org.json.JSONArray expected, org.json.JSONArray actual, JSONCompareResult result) throws org.json.JSONException- Throws:
org.json.JSONException
-
compareJSONArrayWithStrictOrder
protected void compareJSONArrayWithStrictOrder(java.lang.String key, org.json.JSONArray expected, org.json.JSONArray actual, JSONCompareResult result) throws org.json.JSONException- Throws:
org.json.JSONException
-
recursivelyCompareJSONArray
protected void recursivelyCompareJSONArray(java.lang.String key, org.json.JSONArray expected, org.json.JSONArray actual, JSONCompareResult result) throws org.json.JSONException- Throws:
org.json.JSONException
-
-