public final class JSONCompare extends Object
JSONAssert, but it can
be programmed against directly to access the functionality. (eg, to make something that works with a
non-JUnit test framework)| Modifier and Type | Method and Description |
|---|---|
static JSONCompareResult |
compareJSON(org.json.JSONArray expected,
org.json.JSONArray actual,
JSONComparator comparator)
Compares JSON object provided to the expected JSON object using provided comparator, and returns the results of
the comparison.
|
static JSONCompareResult |
compareJSON(org.json.JSONArray expected,
org.json.JSONArray actual,
JSONCompareMode mode)
Compares JSONArray provided to the expected JSONArray, and returns the results of the comparison.
|
static JSONCompareResult |
compareJSON(org.json.JSONObject expected,
org.json.JSONObject actual,
JSONComparator comparator)
Compares JSON object provided to the expected JSON object using provided comparator, and returns the results of
the comparison.
|
static JSONCompareResult |
compareJSON(org.json.JSONObject expected,
org.json.JSONObject actual,
JSONCompareMode mode)
Compares JSONObject provided to the expected JSONObject, and returns the results of the comparison.
|
static JSONCompareResult |
compareJson(JSONString expected,
JSONString actual)
Compares
JSONString provided to the expected JSONString, checking that the
JSONString.toJSONString() are equal. |
static JSONCompareResult |
compareJSON(String expectedStr,
String actualStr,
JSONComparator comparator)
Compares JSON string provided to the expected JSON string using provided comparator, and returns the results of
the comparison.
|
static JSONCompareResult |
compareJSON(String expectedStr,
String actualStr,
JSONCompareMode mode)
Compares JSON string provided to the expected JSON string, and returns the results of the comparison.
|
public static JSONCompareResult compareJSON(String expectedStr, String actualStr, JSONComparator comparator) throws org.json.JSONException
expectedStr - Expected JSON stringactualStr - JSON string to comparecomparator - Comparator to useorg.json.JSONException - JSON parsing errorIllegalArgumentException - when type of expectedStr doesn't match the type of actualStrpublic static JSONCompareResult compareJSON(org.json.JSONObject expected, org.json.JSONObject actual, JSONComparator comparator) throws org.json.JSONException
expected - expected json objectactual - actual json objectcomparator - comparator to useorg.json.JSONException - JSON parsing errorpublic static JSONCompareResult compareJSON(org.json.JSONArray expected, org.json.JSONArray actual, JSONComparator comparator) throws org.json.JSONException
expected - expected json arrayactual - actual json arraycomparator - comparator to useorg.json.JSONException - JSON parsing errorpublic static JSONCompareResult compareJson(JSONString expected, JSONString actual)
JSONString provided to the expected JSONString, checking that the
JSONString.toJSONString() are equal.expected - Expected JSONstringactual - JSONstring to comparepublic static JSONCompareResult compareJSON(String expectedStr, String actualStr, JSONCompareMode mode) throws org.json.JSONException
expectedStr - Expected JSON stringactualStr - JSON string to comparemode - Defines comparison behaviororg.json.JSONException - JSON parsing errorpublic static JSONCompareResult compareJSON(org.json.JSONObject expected, org.json.JSONObject actual, JSONCompareMode mode) throws org.json.JSONException
expected - Expected JSONObjectactual - JSONObject to comparemode - Defines comparison behaviororg.json.JSONException - JSON parsing errorpublic static JSONCompareResult compareJSON(org.json.JSONArray expected, org.json.JSONArray actual, JSONCompareMode mode) throws org.json.JSONException
expected - Expected JSONArrayactual - JSONArray to comparemode - Defines comparison behaviororg.json.JSONException - JSON parsing errorCopyright © 2017. All Rights Reserved.