Package net.javacrumbs.jsonunit.core
Class Configuration
java.lang.Object
net.javacrumbs.jsonunit.core.Configuration
Comparison configuration. Immutable.
-
Constructor Summary
ConstructorsConstructorDescriptionConfiguration(BigDecimal tolerance, Options options, String ignorePlaceholder) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull DifferenceListenerstatic @NotNull Configurationempty()Returns an empty configuration.@NotNull DifferenceListener@NotNull String@Nullable org.hamcrest.Matcher<?>getMatcher(String matcherName) @NotNull NumberComparator@NotNull Options@NotNull List<PathOption>@Nullable BigDecimalbooleanshouldIgnore(String expectedValue) final @NotNull Configurationwhen(@NotNull ConfigurationWhen.PathsParam object, @NotNull ConfigurationWhen.ApplicableForPath... actions) Defines general comparison options.@NotNull ConfigurationAdds 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 ConfigurationwithNumberComparator(@NotNull NumberComparator numberComparator) Sets Number comparator@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:
-
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:
-
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 -
withNumberComparator
@NotNull public @NotNull Configuration withNumberComparator(@NotNull @NotNull NumberComparator numberComparator) Sets Number comparator -
dummyDifferenceListener
-
getMatcher
-
getTolerance
-
getOptions
-
getIgnorePlaceholder
-
getPathOptions
-
getPathsToBeIgnored
-
getDifferenceListener
-
getNumberComparator
-
shouldIgnore
-