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
public static class JsonAssert.ConfigurableJsonAssert extends JsonAssert
JsonAssert that can be configured to prevent mistakes likeassertThatJson(...).isEqualsTo(...).when(...);
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.javacrumbs.jsonunit.assertj.JsonAssert
JsonAssert.ConfigurableJsonAssert
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonAssert.ConfigurableJsonAssertas(String description, Object... args)JsonAssert.ConfigurableJsonAssertas(org.assertj.core.description.Description description)JsonAssert.ConfigurableJsonAssertdescribedAs(String description, Object... args)JsonAssert.ConfigurableJsonAssertdescribedAs(org.assertj.core.description.Description description)JsonAssertinPath(String jsonPath)JsonAssert.ConfigurableJsonAssertwhen(net.javacrumbs.jsonunit.core.ConfigurationWhen.PathsParam object, net.javacrumbs.jsonunit.core.ConfigurationWhen.ApplicableForPath... actions)Adds path specific options.JsonAssert.ConfigurableJsonAssertwhen(net.javacrumbs.jsonunit.core.Option first, net.javacrumbs.jsonunit.core.Option... other)Adds comparison options.JsonAssert.ConfigurableJsonAssertwhenIgnoringPaths(String... pathsToBeIgnored)Makes JsonUnit ignore the specified paths in the actual value.JsonAssert.ConfigurableJsonAssertwithConfiguration(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))) ....JsonAssert.ConfigurableJsonAssertwithDifferenceListener(net.javacrumbs.jsonunit.core.listener.DifferenceListener differenceListener)Sets difference listenerJsonAssert.ConfigurableJsonAssertwithIgnorePlaceholder(String ignorePlaceholder)Sets ignore placeholder.JsonAssert.ConfigurableJsonAssertwithMatcher(String matcherName, org.hamcrest.Matcher<?> matcher)Adds a matcher to be used in ${json-unit.matches:matcherName} macro.JsonAssert.ConfigurableJsonAssertwithOptions(net.javacrumbs.jsonunit.core.internal.Options options)Sets comparison options.JsonAssert.ConfigurableJsonAssertwithTolerance(double tolerance)Sets numerical comparison tolerance.JsonAssert.ConfigurableJsonAssertwithTolerance(BigDecimal tolerance)Sets numerical comparison tolerance.-
Methods inherited from class net.javacrumbs.jsonunit.assertj.JsonAssert
and, asNumber, asString, isAbsent, isArray, isBoolean, isEqualTo, isNotNull, isNull, isNumber, isObject, isPresent, isString, node
-
Methods inherited from class org.assertj.core.api.AbstractAssert
asInstanceOf, asList, descriptionText, doesNotHave, doesNotHaveSameClassAs, equals, failWithMessage, getWritableAssertionInfo, has, hashCode, hasSameClassAs, hasSameHashCodeAs, hasToString, inBinary, inHexadecimal, is, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotOfAnyClassIn, isNotSameAs, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, setCustomRepresentation, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, withFailMessage, withRepresentation, withThreadDumpOnError
-
-
-
-
Method Detail
-
when
public JsonAssert.ConfigurableJsonAssert when(net.javacrumbs.jsonunit.core.Option first, net.javacrumbs.jsonunit.core.Option... other)
Adds comparison options.
-
when
public final JsonAssert.ConfigurableJsonAssert when(net.javacrumbs.jsonunit.core.ConfigurationWhen.PathsParam object, net.javacrumbs.jsonunit.core.ConfigurationWhen.ApplicableForPath... actions)
Adds path specific options.- See Also:
Configuration.when(PathsParam, ApplicableForPath...)
-
withOptions
public JsonAssert.ConfigurableJsonAssert withOptions(net.javacrumbs.jsonunit.core.internal.Options options)
Sets comparison options.- Parameters:
options-- Returns:
-
withConfiguration
public JsonAssert.ConfigurableJsonAssert withConfiguration(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
public JsonAssert.ConfigurableJsonAssert withTolerance(BigDecimal tolerance)
Sets numerical comparison tolerance.- Parameters:
tolerance-- Returns:
-
withTolerance
public JsonAssert.ConfigurableJsonAssert withTolerance(double tolerance)
Sets numerical comparison tolerance.- Parameters:
tolerance-- Returns:
-
whenIgnoringPaths
public JsonAssert.ConfigurableJsonAssert whenIgnoringPaths(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
public JsonAssert.ConfigurableJsonAssert withIgnorePlaceholder(String ignorePlaceholder)
Sets ignore placeholder.- Parameters:
ignorePlaceholder-- Returns:
-
withMatcher
public JsonAssert.ConfigurableJsonAssert withMatcher(String matcherName, org.hamcrest.Matcher<?> matcher)
Adds a matcher to be used in ${json-unit.matches:matcherName} macro.- Parameters:
matcherName-matcher-- Returns:
-
withDifferenceListener
public JsonAssert.ConfigurableJsonAssert withDifferenceListener(net.javacrumbs.jsonunit.core.listener.DifferenceListener differenceListener)
Sets difference listener
-
inPath
public JsonAssert inPath(String jsonPath)
-
describedAs
public JsonAssert.ConfigurableJsonAssert describedAs(org.assertj.core.description.Description description)
- Specified by:
describedAsin interfaceorg.assertj.core.api.Descriptable<JsonAssert>- Overrides:
describedAsin classorg.assertj.core.api.AbstractAssert<JsonAssert,Object>
-
describedAs
public JsonAssert.ConfigurableJsonAssert describedAs(String description, Object... args)
- Specified by:
describedAsin interfaceorg.assertj.core.api.Descriptable<JsonAssert>- Overrides:
describedAsin classorg.assertj.core.api.AbstractAssert<JsonAssert,Object>
-
as
public JsonAssert.ConfigurableJsonAssert as(org.assertj.core.description.Description description)
- Specified by:
asin interfaceorg.assertj.core.api.Descriptable<JsonAssert>- Overrides:
asin classorg.assertj.core.api.AbstractAssert<JsonAssert,Object>
-
as
public JsonAssert.ConfigurableJsonAssert as(String description, Object... args)
- Specified by:
asin interfaceorg.assertj.core.api.Descriptable<JsonAssert>- Overrides:
asin classorg.assertj.core.api.AbstractAssert<JsonAssert,Object>
-
-