|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Object java.lang.Enum<JSONCompareMode> org.skyscreamer.jsonassert.JSONCompareMode
public enum JSONCompareMode
These different modes define different behavior for the comparison of JSON for testing. Each mode encapsulates two underlying behaviors: extensibility and strict ordering.
Extensible | Strict Ordering | |
---|---|---|
STRICT | no | yes |
LENIENT | yes | no |
NON_EXTENSIBLE | no | no |
STRICT_ORDER | yes | yes |
If extensbility not allowed, then all of the expected values must match in what's being tested, but any additional fields will cause the test to fail. When extensibility is allowed, all values must still match. For example, if you're expecting:
{id:1,name:"Carter"}
Then the following will pass when extensible, and will fail when not:
{id:1,name:"Carter",favoriteColor:"blue"}
If strict ordering is enabled, JSON arrays must be in strict sequence. For example, if you're expecting:
{id:1,friends:[{id:2},{id:3}]}
Then the following will fail strict ordering, but will otherwise pass:
{id:1,friends:[{id:3},{id:2}]}
Enum Constant Summary | |
---|---|
LENIENT
Lenient checking. |
|
NON_EXTENSIBLE
Non-extensible checking. |
|
STRICT
Strict checking. |
|
STRICT_ORDER
Strict order checking. |
Method Summary | |
---|---|
boolean |
hasStrictOrder()
Strict order required |
boolean |
isExtensible()
Is extensible |
static JSONCompareMode |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. |
static JSONCompareMode[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final JSONCompareMode STRICT
public static final JSONCompareMode LENIENT
public static final JSONCompareMode NON_EXTENSIBLE
public static final JSONCompareMode STRICT_ORDER
Method Detail |
---|
public static JSONCompareMode[] values()
for (JSONCompareMode c : JSONCompareMode.values()) System.out.println(c);
public static JSONCompareMode valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.
java.lang.IllegalArgumentException
- if this enum type has no constant
with the specified name
java.lang.NullPointerException
- if the argument is nullpublic boolean isExtensible()
public boolean hasStrictOrder()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |