Package net.javacrumbs.jsonunit.core
Class ConfigurationWhen
java.lang.Object
net.javacrumbs.jsonunit.core.ConfigurationWhen
Everything for
Configuration.when(PathsParam, ApplicableForPath...)-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic class -
Method Summary
Modifier and TypeMethodDescriptionstatic ConfigurationWhen.PathsParamAdds path conditions.static ConfigurationWhen.PathsParamstatic ConfigurationWhen.PathsParamrootPath()Applies specified options to the object.Marks that the object should be ignored.Explicitly remove options from the objects.
-
Method Details
-
path
Adds path conditions. Examples:- Ignore order for [*].a:
when(path("[*].a"), then(IGNORING_ARRAY_ORDER))` - Fully ignore multiple paths:
when(paths("[*].b", "[*].c"), thenIgnore())` - Ignore array order for every path except [*].b:
when(IGNORING_ARRAY_ORDER).when(path("[*].b"), thenNot(IGNORING_ARRAY_ORDER))
- Ignore order for [*].a:
-
paths
-
rootPath
-
then
Applies specified options to the object. UsethenNot(net.javacrumbs.jsonunit.core.Option, net.javacrumbs.jsonunit.core.Option...)to explicitly remove options from the path.
When passing a path, optionsOption.TREATING_NULL_AS_ABSENTandOption.IGNORING_VALUESexpect paths to the field which supposed to be treated as absent or value-ignored. Example:when(path("a.b"), then(TREATING_NULL_AS_ABSENT))for JSON of{"a": 1, "b": null}.
For any other option specify the path to an object with ignorable child fields, or path to an array:when(path("a.array"), then(IGNORING_ARRAY_ORDER))for{"a": {"array": [1, 2, 3]}} -
thenNot
Explicitly remove options from the objects. -
thenIgnore
Marks that the object should be ignored.
-