public class JsonExpectationsHelper extends Object
Use of this class requires the JSONassert library.
Constructor and Description |
---|
JsonExpectationsHelper() |
Modifier and Type | Method and Description |
---|---|
void |
assertJsonEqual(String expected,
String actual)
Parse the expected and actual strings as JSON and assert the two
are "similar" - i.e.
|
void |
assertJsonEqual(String expected,
String actual,
boolean strict)
Parse the expected and actual strings as JSON and assert the two
are "similar" - i.e.
|
void |
assertJsonNotEqual(String expected,
String actual)
Parse the expected and actual strings as JSON and assert the two
are "not similar" - i.e.
|
void |
assertJsonNotEqual(String expected,
String actual,
boolean strict)
Parse the expected and actual strings as JSON and assert the two
are "not similar" - i.e.
|
public void assertJsonEqual(String expected, String actual) throws Exception
expected
- the expected JSON contentactual
- the actual JSON contentException
assertJsonEqual(String, String, boolean)
public void assertJsonEqual(String expected, String actual, boolean strict) throws Exception
Can compare in two modes, depending on strict
parameter value:
true
: strict checking. Not extensible, and strict array ordering.false
: lenient checking. Extensible, and non-strict array ordering.expected
- the expected JSON contentactual
- the actual JSON contentstrict
- enables strict checkingException
public void assertJsonNotEqual(String expected, String actual) throws Exception
expected
- the expected JSON contentactual
- the actual JSON contentException
assertJsonNotEqual(String, String, boolean)
public void assertJsonNotEqual(String expected, String actual, boolean strict) throws Exception
Can compare in two modes, depending on strict
parameter value:
true
: strict checking. Not extensible, and strict array ordering.false
: lenient checking. Extensible, and non-strict array ordering.expected
- the expected JSON contentactual
- the actual JSON contentstrict
- enables strict checkingException