Package net.javacrumbs.jsonunit.assertj
Class JsonAssert.ConfigurableJsonAssert
java.lang.Object
org.assertj.core.api.AbstractAssert<JsonAssert,Object>
net.javacrumbs.jsonunit.assertj.JsonAssert
net.javacrumbs.jsonunit.assertj.JsonAssert.ConfigurableJsonAssert
- All Implemented Interfaces:
org.assertj.core.api.Assert<JsonAssert,
,Object> org.assertj.core.api.Descriptable<JsonAssert>
,org.assertj.core.api.ExtensionPoints<JsonAssert,
Object>
- Enclosing class:
- JsonAssert
JsonAssert that can be configured to prevent mistakes like
assertThatJson(...).isEqualsTo(...).when(...);
-
Nested Class Summary
Nested classes/interfaces inherited from class net.javacrumbs.jsonunit.assertj.JsonAssert
JsonAssert.ConfigurableJsonAssert
-
Field Summary
Fields inherited from class org.assertj.core.api.AbstractAssert
actual, info, myself, objects, throwUnsupportedExceptionOnEquals
-
Method Summary
Modifier and TypeMethodDescription@NotNull JsonAssert.ConfigurableJsonAssert
@NotNull JsonAssert.ConfigurableJsonAssert
as
(@NotNull org.assertj.core.description.Description description) @NotNull JsonAssert.ConfigurableJsonAssert
describedAs
(@NotNull String description, Object... args) @NotNull JsonAssert.ConfigurableJsonAssert
describedAs
(@NotNull org.assertj.core.description.Description description) @NotNull JsonAssert
final @NotNull JsonAssert.ConfigurableJsonAssert
when
(@NotNull net.javacrumbs.jsonunit.core.ConfigurationWhen.PathsParam object, @NotNull net.javacrumbs.jsonunit.core.ConfigurationWhen.ApplicableForPath... actions) Adds path specific options.@NotNull JsonAssert.ConfigurableJsonAssert
when
(@NotNull net.javacrumbs.jsonunit.core.Option first, @NotNull net.javacrumbs.jsonunit.core.Option... other) Adds comparison options.@NotNull JsonAssert.ConfigurableJsonAssert
whenIgnoringPaths
(@NotNull String... pathsToBeIgnored) Makes JsonUnit ignore the specified paths in the actual value.@NotNull JsonAssert.ConfigurableJsonAssert
withConfiguration
(@NotNull Function<net.javacrumbs.jsonunit.core.Configuration, net.javacrumbs.jsonunit.core.Configuration> configurationFunction) Allows to configure like thisassertThatJson(...) .withConfiguration(c -> c.withMatcher("positive", greaterThan(valueOf(0))) ....
@NotNull JsonAssert.ConfigurableJsonAssert
withDifferenceListener
(@NotNull net.javacrumbs.jsonunit.core.listener.DifferenceListener differenceListener) Sets difference listener@NotNull JsonAssert.ConfigurableJsonAssert
withIgnorePlaceholder
(@NotNull String ignorePlaceholder) Sets ignore placeholder.@NotNull JsonAssert.ConfigurableJsonAssert
withMatcher
(@NotNull String matcherName, @NotNull org.hamcrest.Matcher<?> matcher) Adds a matcher to be used in ${json-unit.matches:matcherName} macro.@NotNull JsonAssert.ConfigurableJsonAssert
withOptions
(@NotNull net.javacrumbs.jsonunit.core.internal.Options options) Sets comparison options.@NotNull JsonAssert.ConfigurableJsonAssert
withTolerance
(double tolerance) Sets numerical comparison tolerance.@NotNull JsonAssert.ConfigurableJsonAssert
withTolerance
(@Nullable BigDecimal tolerance) Sets numerical comparison tolerance.Methods inherited from class net.javacrumbs.jsonunit.assertj.JsonAssert
and, asNumber, asString, isAbsent, isArray, isBoolean, isEqualTo, isIntegralNumber, isNotNull, isNull, isNumber, isObject, isPresent, isString, isUri, node
Methods inherited from class org.assertj.core.api.AbstractAssert
asInstanceOf, asList, assertionError, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, inBinary, inHexadecimal, is, isElementOfCustomAssert, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotOfAnyClassIn, isNotSameAs, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, overridingErrorMessage, satisfies, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOfForProxy, satisfiesForProxy, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, usingRecursiveComparison, usingRecursiveComparison, withFailMessage, withFailMessage, withRepresentation, withThreadDumpOnError
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.assertj.core.api.Descriptable
as
-
Method Details
-
when
@NotNull public @NotNull JsonAssert.ConfigurableJsonAssert when(@NotNull @NotNull net.javacrumbs.jsonunit.core.Option first, @NotNull @NotNull net.javacrumbs.jsonunit.core.Option... other) Adds comparison options. -
when
@NotNull public final @NotNull JsonAssert.ConfigurableJsonAssert when(@NotNull @NotNull net.javacrumbs.jsonunit.core.ConfigurationWhen.PathsParam object, @NotNull @NotNull net.javacrumbs.jsonunit.core.ConfigurationWhen.ApplicableForPath... actions) Adds path specific options.- See Also:
-
Configuration.when(PathsParam, ApplicableForPath...)
-
withOptions
@NotNull public @NotNull JsonAssert.ConfigurableJsonAssert withOptions(@NotNull @NotNull net.javacrumbs.jsonunit.core.internal.Options options) Sets comparison options.- Parameters:
options
-- Returns:
-
withConfiguration
@NotNull public @NotNull JsonAssert.ConfigurableJsonAssert withConfiguration(@NotNull @NotNull Function<net.javacrumbs.jsonunit.core.Configuration, net.javacrumbs.jsonunit.core.Configuration> configurationFunction) Allows to configure like thisassertThatJson(...) .withConfiguration(c -> c.withMatcher("positive", greaterThan(valueOf(0))) ....
-
withTolerance
@NotNull public @NotNull JsonAssert.ConfigurableJsonAssert withTolerance(@Nullable @Nullable BigDecimal tolerance) Sets numerical comparison tolerance.- Parameters:
tolerance
-- Returns:
-
withTolerance
Sets numerical comparison tolerance.- Parameters:
tolerance
-- Returns:
-
whenIgnoringPaths
@NotNull public @NotNull JsonAssert.ConfigurableJsonAssert 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:
-
withIgnorePlaceholder
@NotNull public @NotNull JsonAssert.ConfigurableJsonAssert withIgnorePlaceholder(@NotNull @NotNull String ignorePlaceholder) Sets ignore placeholder.- Parameters:
ignorePlaceholder
-- Returns:
-
withMatcher
@NotNull public @NotNull JsonAssert.ConfigurableJsonAssert 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 JsonAssert.ConfigurableJsonAssert withDifferenceListener(@NotNull @NotNull net.javacrumbs.jsonunit.core.listener.DifferenceListener differenceListener) Sets difference listener -
inPath
-
describedAs
@NotNull public @NotNull JsonAssert.ConfigurableJsonAssert describedAs(@NotNull @NotNull org.assertj.core.description.Description description) - Specified by:
describedAs
in interfaceorg.assertj.core.api.Descriptable<JsonAssert>
- Overrides:
describedAs
in classorg.assertj.core.api.AbstractAssert<JsonAssert,
Object>
-
describedAs
@NotNull public @NotNull JsonAssert.ConfigurableJsonAssert describedAs(@NotNull @NotNull String description, Object... args) -
as
@NotNull public @NotNull JsonAssert.ConfigurableJsonAssert as(@NotNull @NotNull org.assertj.core.description.Description description) -
as
@NotNull public @NotNull JsonAssert.ConfigurableJsonAssert as(@NotNull @NotNull String description, Object... args)
-