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 like assertThatJson(...).isEqualsTo(...).when(...);
  • 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 this assertThatJson(...) .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

      @NotNull public @NotNull JsonAssert.ConfigurableJsonAssert withTolerance(double tolerance)
      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

      @NotNull public @NotNull JsonAssert inPath(@NotNull @NotNull String jsonPath)
    • describedAs

      @NotNull public @NotNull JsonAssert.ConfigurableJsonAssert describedAs(@NotNull @NotNull org.assertj.core.description.Description description)
      Specified by:
      describedAs in interface org.assertj.core.api.Descriptable<JsonAssert>
      Overrides:
      describedAs in class org.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)