Interface JSONComparator

All Known Implementing Classes:
AbstractComparator, ArraySizeComparator, CustomComparator, DefaultComparator

public interface JSONComparator
Interface for comparison handler.
Author:
Ivan Zaytsev 2013-01-04
  • Method Details

    • compareJSON

      JSONCompareResult compareJSON(org.json.JSONObject expected, org.json.JSONObject actual)
      Compares two JSONObjects and returns the result of the comparison in a JSONCompareResult object.
      Parameters:
      expected - the expected JSON object
      actual - the actual JSON object
      Returns:
      the result of the comparison
    • compareJSON

      JSONCompareResult compareJSON(org.json.JSONArray expected, org.json.JSONArray actual)
      Compares two JSONArrays and returns the result of the comparison in a JSONCompareResult object.
      Parameters:
      expected - the expected JSON array
      actual - 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 two JSONObjects on the provided path represented by prefix and updates the result of the comparison in the result JSONCompareResult object.
      Parameters:
      prefix - the path in the json where the comparison happens
      expected - the expected JSON object
      actual - the actual JSON object
      result - stores the actual state of the comparison result
    • compareValues

      void compareValues(String prefix, Object expectedValue, Object actualValue, JSONCompareResult result)
      Compares two Objects on the provided path represented by prefix and updates the result of the comparison in the result JSONCompareResult object.
      Parameters:
      prefix - the path in the json where the comparison happens
      expectedValue - the expected value
      actualValue - the actual value
      result - stores the actual state of the comparison result
    • compareJSONArray

      void compareJSONArray(String prefix, org.json.JSONArray expected, org.json.JSONArray actual, JSONCompareResult result)
      Compares two JSONArrays on the provided path represented by prefix and updates the result of the comparison in the result JSONCompareResult object.
      Parameters:
      prefix - the path in the json where the comparison happens
      expected - the expected JSON array
      actual - the actual JSON array
      result - stores the actual state of the comparison result