Interface JSONComparator
- All Known Implementing Classes:
AbstractComparator,ArraySizeComparator,CustomComparator,DefaultComparator
public interface JSONComparator
Interface for comparison handler.
- Author:
- Ivan Zaytsev 2013-01-04
-
Method Summary
Modifier and TypeMethodDescriptionvoidcompareJSON(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.compareJSON(org.json.JSONArray expected, org.json.JSONArray actual) Compares twoJSONArrays and returns the result of the comparison in aJSONCompareResultobject.compareJSON(org.json.JSONObject expected, org.json.JSONObject actual) Compares twoJSONObjects and returns the result of the comparison in aJSONCompareResultobject.voidcompareJSONArray(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(String prefix, Object expectedValue, Object actualValue, JSONCompareResult result) Compares twoObjects on the provided path represented byprefixand updates the result of the comparison in theresultJSONCompareResultobject.
-
Method Details
-
compareJSON
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
-
compareJSON
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
-
compareJSON
void compareJSON(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.- 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
-
compareValues
void compareValues(String prefix, Object expectedValue, Object actualValue, JSONCompareResult result) Compares 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
-
compareJSONArray
void compareJSONArray(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.- 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
-