Package net.javacrumbs.jsonunit.core
Class ConfigurationWhen
java.lang.Object
net.javacrumbs.jsonunit.core.ConfigurationWhen
public class ConfigurationWhen extends Object
Everything for
Configuration.when(PathsParam, ApplicableForPath...)-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceConfigurationWhen.ApplicableForPathstatic classConfigurationWhen.PathsParam -
Method Summary
Modifier and Type Method Description static ConfigurationWhen.PathsParampath(String path)Adds path conditions.static ConfigurationWhen.PathsParampaths(String... paths)static ConfigurationWhen.PathsParamrootPath()static ConfigurationWhen.ApplicableForPaththen(Option first, Option... next)Applies specified options to the object.static ConfigurationWhen.ApplicableForPaththenIgnore()Marks that the object should be ignored.static ConfigurationWhen.ApplicableForPaththenNot(Option first, Option... next)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.
-