org.skyscreamer.jsonassert.comparator
Class AbstractComparator

java.lang.Object
  extended by org.skyscreamer.jsonassert.comparator.AbstractComparator
All Implemented Interfaces:
JSONComparator
Direct Known Subclasses:
DefaultComparator

public abstract class AbstractComparator
extends Object
implements JSONComparator

This class provides a skeletal implementation of the JSONComparator interface, to minimize the effort required to implement this interface.


Constructor Summary
AbstractComparator()
           
 
Method Summary
protected  void checkJsonObjectKeysActualInExpected(String prefix, org.json.JSONObject expected, org.json.JSONObject actual, JSONCompareResult result)
           
protected  void checkJsonObjectKeysExpectedInActual(String prefix, org.json.JSONObject expected, org.json.JSONObject actual, JSONCompareResult result)
           
 JSONCompareResult compareJSON(org.json.JSONArray expected, org.json.JSONArray actual)
          Compares JSONArray provided to the expected JSONArray, and returns the results of the comparison.
 JSONCompareResult compareJSON(org.json.JSONObject expected, org.json.JSONObject actual)
          Compares JSONObject provided to the expected JSONObject, and returns the results of the comparison.
protected  void compareJSONArrayOfJsonObjects(String key, org.json.JSONArray expected, org.json.JSONArray actual, JSONCompareResult result)
           
protected  void compareJSONArrayOfSimpleValues(String key, org.json.JSONArray expected, org.json.JSONArray actual, JSONCompareResult result)
           
protected  void compareJSONArrayWithStrictOrder(String key, org.json.JSONArray expected, org.json.JSONArray actual, JSONCompareResult result)
           
protected  void recursivelyCompareJSONArray(String key, org.json.JSONArray expected, org.json.JSONArray actual, JSONCompareResult result)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.skyscreamer.jsonassert.comparator.JSONComparator
compareJSON, compareJSONArray, compareValues
 

Constructor Detail

AbstractComparator

public AbstractComparator()
Method Detail

compareJSON

public final JSONCompareResult compareJSON(org.json.JSONObject expected,
                                           org.json.JSONObject actual)
                                    throws org.json.JSONException
Compares JSONObject provided to the expected JSONObject, and returns the results of the comparison.

Specified by:
compareJSON in interface JSONComparator
Parameters:
expected - Expected JSONObject
actual - JSONObject to compare
Throws:
org.json.JSONException

compareJSON

public final JSONCompareResult compareJSON(org.json.JSONArray expected,
                                           org.json.JSONArray actual)
                                    throws org.json.JSONException
Compares JSONArray provided to the expected JSONArray, and returns the results of the comparison.

Specified by:
compareJSON in interface JSONComparator
Parameters:
expected - Expected JSONArray
actual - JSONArray to compare
Throws:
org.json.JSONException

checkJsonObjectKeysActualInExpected

protected void checkJsonObjectKeysActualInExpected(String prefix,
                                                   org.json.JSONObject expected,
                                                   org.json.JSONObject actual,
                                                   JSONCompareResult result)

checkJsonObjectKeysExpectedInActual

protected void checkJsonObjectKeysExpectedInActual(String prefix,
                                                   org.json.JSONObject expected,
                                                   org.json.JSONObject actual,
                                                   JSONCompareResult result)
                                            throws org.json.JSONException
Throws:
org.json.JSONException

compareJSONArrayOfJsonObjects

protected void compareJSONArrayOfJsonObjects(String key,
                                             org.json.JSONArray expected,
                                             org.json.JSONArray actual,
                                             JSONCompareResult result)
                                      throws org.json.JSONException
Throws:
org.json.JSONException

compareJSONArrayOfSimpleValues

protected void compareJSONArrayOfSimpleValues(String key,
                                              org.json.JSONArray expected,
                                              org.json.JSONArray actual,
                                              JSONCompareResult result)
                                       throws org.json.JSONException
Throws:
org.json.JSONException

compareJSONArrayWithStrictOrder

protected void compareJSONArrayWithStrictOrder(String key,
                                               org.json.JSONArray expected,
                                               org.json.JSONArray actual,
                                               JSONCompareResult result)
                                        throws org.json.JSONException
Throws:
org.json.JSONException

recursivelyCompareJSONArray

protected void recursivelyCompareJSONArray(String key,
                                           org.json.JSONArray expected,
                                           org.json.JSONArray actual,
                                           JSONCompareResult result)
                                    throws org.json.JSONException
Throws:
org.json.JSONException


Copyright © 2013. All Rights Reserved.