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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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.JSONCompareResult
compareJSON(org.json.JSONArray expected, org.json.JSONArray actual)
Compares twoJSONArray
s and returns the result of the comparison in aJSONCompareResult
object.JSONCompareResult
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 Detail
-
compareJSON
JSONCompareResult compareJSON(org.json.JSONObject expected, org.json.JSONObject actual) throws org.json.JSONException
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
- Throws:
org.json.JSONException
- JSON parsing error
-
compareJSON
JSONCompareResult compareJSON(org.json.JSONArray expected, org.json.JSONArray actual) throws org.json.JSONException
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
- Throws:
org.json.JSONException
- JSON parsing error
-
compareJSON
void compareJSON(String prefix, org.json.JSONObject expected, org.json.JSONObject actual, JSONCompareResult result) throws org.json.JSONException
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- Throws:
org.json.JSONException
- JSON parsing error
-
compareValues
void compareValues(String prefix, Object expectedValue, Object actualValue, JSONCompareResult result) throws org.json.JSONException
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- Throws:
org.json.JSONException
- JSON parsing error
-
compareJSONArray
void compareJSONArray(String prefix, org.json.JSONArray expected, org.json.JSONArray actual, JSONCompareResult result) throws org.json.JSONException
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- Throws:
org.json.JSONException
- JSON parsing error
-
-