org.skyscreamer.jsonassert
Class JSONCompareResult

java.lang.Object
  extended by org.skyscreamer.jsonassert.JSONCompareResult

public class JSONCompareResult
extends Object

Bean for holding results from JSONCompare.


Constructor Summary
JSONCompareResult()
          Default constructor.
 
Method Summary
protected  void fail(String message)
           
protected  void fail(String field, Object expected, Object actual)
          Identify that the comparison failed
 boolean failed()
          Did the comparison fail?
 Object getActual()
          Actual field value
 Object getExpected()
          Expected field value
 String getField()
          Dot-separated path the the field that failed comparison
 String getMessage()
          Result message
 boolean isFailureOnField()
          Check if comparison failed on a particular field
 boolean passed()
          Did the comparison pass?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSONCompareResult

public JSONCompareResult()
Default constructor.

Method Detail

passed

public boolean passed()
Did the comparison pass?

Returns:
True if it passed

failed

public boolean failed()
Did the comparison fail?

Returns:
True if it failed

getMessage

public String getMessage()
Result message

Returns:
String explaining why if the comparison failed

getActual

public Object getActual()
Actual field value

Returns:
a JSONObject, JSONArray or other Object instance, or null if the comparison did not fail on a particular field

getExpected

public Object getExpected()
Expected field value

Returns:
a JSONObject, JSONArray or other Object instance, or null if the comparison did not fail on a particular field

isFailureOnField

public boolean isFailureOnField()
Check if comparison failed on a particular field


getField

public String getField()
Dot-separated path the the field that failed comparison

Returns:
a String instance, or null if the comparison did not fail on a particular field

fail

protected void fail(String message)

fail

protected void fail(String field,
                    Object expected,
                    Object actual)
Identify that the comparison failed

Parameters:
field - Which field failed
expected - Expected result
actual - Actual result


Copyright © 2012. All Rights Reserved.