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 TypeMethodDescriptionvoid
compareJSON
(String prefix, org.json.JSONObject expected, org.json.JSONObject actual, JSONCompareResult result) Compares twoJSONObject
s on the provided path represented byprefix
and updates the result of the comparison in theresult
JSONCompareResult
object.compareJSON
(org.json.JSONArray expected, org.json.JSONArray actual) Compares twoJSONArray
s and returns the result of the comparison in aJSONCompareResult
object.compareJSON
(org.json.JSONObject expected, org.json.JSONObject actual) Compares twoJSONObject
s and returns the result of the comparison in aJSONCompareResult
object.void
compareJSONArray
(String prefix, org.json.JSONArray expected, org.json.JSONArray actual, JSONCompareResult result) Compares twoJSONArray
s on the provided path represented byprefix
and updates the result of the comparison in theresult
JSONCompareResult
object.void
compareValues
(String prefix, Object expectedValue, Object actualValue, JSONCompareResult result) Compares twoObject
s on the provided path represented byprefix
and updates the result of the comparison in theresult
JSONCompareResult
object.
-
Method Details
-
compareJSON
Compares twoJSONObject
s and returns the result of the comparison in aJSONCompareResult
object.- Parameters:
expected
- the expected JSON objectactual
- the actual JSON object- Returns:
- the result of the comparison
-
compareJSON
Compares twoJSONArray
s and returns the result of the comparison in aJSONCompareResult
object.- 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 twoJSONObject
s on the provided path represented byprefix
and updates the result of the comparison in theresult
JSONCompareResult
object.- 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 twoObject
s on the provided path represented byprefix
and updates the result of the comparison in theresult
JSONCompareResult
object.- 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 twoJSONArray
s on the provided path represented byprefix
and updates the result of the comparison in theresult
JSONCompareResult
object.- 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
-