Package net.javacrumbs.jsonunit.core
Class Configuration
java.lang.Object
net.javacrumbs.jsonunit.core.Configuration
public class Configuration extends Object
Comparison configuration. Immutable.
-
Constructor Summary
Constructors Constructor Description Configuration(BigDecimal tolerance, Options options, String ignorePlaceholder)Deprecated. -
Method Summary
Modifier and Type Method Description static @NotNull DifferenceListenerdummyDifferenceListener()static @NotNull Configurationempty()Returns an empty configuration.@NotNull DifferenceListenergetDifferenceListener()@NotNull StringgetIgnorePlaceholder()@Nullable org.hamcrest.Matcher<?>getMatcher(String matcherName)@NotNull OptionsgetOptions()@NotNull List<PathOption>getPathOptions()@NotNull Set<String>getPathsToBeIgnored()@Nullable BigDecimalgetTolerance()booleanshouldIgnore(String expectedValue)@NotNull Configurationwhen(@NotNull ConfigurationWhen.PathsParam object, @NotNull ConfigurationWhen.ApplicableForPath... actions)Defines general comparison options.@NotNull Configurationwhen(@NotNull Option first, @NotNull Option... next)Adds comparison options.@NotNull ConfigurationwhenIgnoringPaths(@NotNull String... pathsToBeIgnored)Makes JsonUnit ignore the specified paths in the actual value.@NotNull ConfigurationwhenIgnoringPaths(@NotNull Collection<String> pathsToBeIgnored)@NotNull ConfigurationwithDifferenceListener(@NotNull DifferenceListener differenceListener)Sets difference listener@NotNull ConfigurationwithIgnorePlaceholder(@NotNull String ignorePlaceholder)Sets ignore placeholder.@NotNull ConfigurationwithMatcher(@NotNull String matcherName, @NotNull org.hamcrest.Matcher<?> matcher)Adds a matcher to be used in ${json-unit.matches:matcherName} macro.@NotNull ConfigurationwithOptions(@NotNull Options options)Sets comparison options.@NotNull ConfigurationwithOptions(@NotNull Option first, @NotNull Option... next)Adds comparison options.@NotNull ConfigurationwithPathOptions(@NotNull List<PathOption> pathOptions)@NotNull ConfigurationwithTolerance(double tolerance)Sets numerical comparison tolerance.@NotNull ConfigurationwithTolerance(@Nullable BigDecimal tolerance)Sets numerical comparison tolerance.
-
Constructor Details
-
Configuration
Deprecated.
-
-
Method Details
-
empty
Returns an empty configuration. -
withTolerance
Sets numerical comparison tolerance.- Parameters:
tolerance-- Returns:
-
withTolerance
Sets numerical comparison tolerance.- Parameters:
tolerance-- Returns:
-
when
@NotNull public @NotNull Configuration when(@NotNull @NotNull Option first, @NotNull @NotNull Option... next)Adds comparison options.- Parameters:
first-next-- Returns:
-
withOptions
@NotNull public @NotNull Configuration withOptions(@NotNull @NotNull Option first, @NotNull @NotNull Option... next)Adds comparison options.- Parameters:
first-next-- Returns:
-
withOptions
Sets comparison options.- Parameters:
options-- Returns:
-
when
@NotNull public final @NotNull Configuration when(@NotNull @NotNull ConfigurationWhen.PathsParam object, @NotNull @NotNull ConfigurationWhen.ApplicableForPath... actions)Defines general comparison options. SeeConfigurationWhen.path(java.lang.String)for some examples.- Parameters:
object- an object to apply actions, e.g.ConfigurationWhen.path(java.lang.String),ConfigurationWhen.rootPath().actions- actions to be applied on the object.- See Also:
ConfigurationWhen.path(java.lang.String)
-
withPathOptions
@NotNull public @NotNull Configuration withPathOptions(@NotNull @NotNull List<PathOption> pathOptions) -
whenIgnoringPaths
@NotNull public @NotNull Configuration whenIgnoringPaths(@NotNull @NotNull Collection<String> pathsToBeIgnored) -
whenIgnoringPaths
@NotNull public @NotNull Configuration whenIgnoringPaths(@NotNull @NotNull String... pathsToBeIgnored)Makes JsonUnit ignore the specified paths in the actual value. If the path matches, it's completely ignored. It may be missing, null or have any value- Parameters:
pathsToBeIgnored-- Returns:
- See Also:
ConfigurationWhen.thenIgnore()
-
withIgnorePlaceholder
@NotNull public @NotNull Configuration withIgnorePlaceholder(@NotNull @NotNull String ignorePlaceholder)Sets ignore placeholder.- Parameters:
ignorePlaceholder-- Returns:
-
withMatcher
@NotNull public @NotNull Configuration withMatcher(@NotNull @NotNull String matcherName, @NotNull @NotNull org.hamcrest.Matcher<?> matcher)Adds a matcher to be used in ${json-unit.matches:matcherName} macro.- Parameters:
matcherName-matcher-- Returns:
-
withDifferenceListener
@NotNull public @NotNull Configuration withDifferenceListener(@NotNull @NotNull DifferenceListener differenceListener)Sets difference listener -
dummyDifferenceListener
-
getMatcher
-
getTolerance
-
getOptions
-
getIgnorePlaceholder
-
getPathOptions
-
getPathsToBeIgnored
-
getDifferenceListener
-
shouldIgnore
-