Interface JSONComparator
-
- All Known Implementing Classes:
AbstractComparator,ArraySizeComparator,CustomComparator,DefaultComparator
public interface JSONComparatorInterface for comparison handler.- Author:
- Ivan Zaytsev 2013-01-04
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcompareJSON(java.lang.String prefix, org.json.JSONObject expected, org.json.JSONObject actual, JSONCompareResult result)Compares twoJSONObjects on the provided path represented byprefixand updates the result of the comparison in theresultJSONCompareResultobject.JSONCompareResultcompareJSON(org.json.JSONArray expected, org.json.JSONArray actual)Compares twoJSONArrays and returns the result of the comparison in aJSONCompareResultobject.JSONCompareResultcompareJSON(org.json.JSONObject expected, org.json.JSONObject actual)Compares twoJSONObjects and returns the result of the comparison in aJSONCompareResultobject.voidcompareJSONArray(java.lang.String prefix, org.json.JSONArray expected, org.json.JSONArray actual, JSONCompareResult result)Compares twoJSONArrays on the provided path represented byprefixand updates the result of the comparison in theresultJSONCompareResultobject.voidcompareValues(java.lang.String prefix, java.lang.Object expectedValue, java.lang.Object actualValue, JSONCompareResult result)Compares twoObjects on the provided path represented byprefixand updates the result of the comparison in theresultJSONCompareResultobject.
-
-
-
Method Detail
-
compareJSON
JSONCompareResult compareJSON(org.json.JSONObject expected, org.json.JSONObject actual) throws org.json.JSONException
Compares twoJSONObjects and returns the result of the comparison in aJSONCompareResultobject.- Parameters:
expected- the expected JSON objectactual- 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 twoJSONArrays and returns the result of the comparison in aJSONCompareResultobject.- Parameters:
expected- the expected JSON arrayactual- 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.JSONExceptionCompares twoJSONObjects on the provided path represented byprefixand updates the result of the comparison in theresultJSONCompareResultobject.- Parameters:
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 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.JSONExceptionCompares twoObjects on the provided path represented byprefixand updates the result of the comparison in theresultJSONCompareResultobject.- Parameters:
prefix- the path in the json where the comparison happensexpectedValue- the expected valueactualValue- the actual valueresult- 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.JSONExceptionCompares twoJSONArrays on the provided path represented byprefixand updates the result of the comparison in theresultJSONCompareResultobject.- Parameters:
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 result- Throws:
org.json.JSONException- JSON parsing error
-
-