Class JsonFluentAssert.ConfigurableJsonFluentAssert

  • Enclosing class:
    JsonFluentAssert

    public static class JsonFluentAssert.ConfigurableJsonFluentAssert
    extends JsonFluentAssert
    JsonFluentAssert that can be configured. To make sure that configuration is done before comparison and not after.
    • Method Detail

      • node

        public JsonFluentAssert.ConfigurableJsonFluentAssert node​(String newPath)
        Creates an assert object that only compares given node. The path is denoted by JSON path, for example. Second call navigates from the root. assertThatJson("{\"root\":{\"test\":[1,2,3]}}").node("root.test[0]").isEqualTo("1");
        Overrides:
        node in class JsonFluentAssert
        Parameters:
        newPath -
        Returns:
        object comparing only node given by path.
      • whenIgnoringPaths

        public JsonFluentAssert.ConfigurableJsonFluentAssert 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
      • withTolerance

        public JsonFluentAssert.ConfigurableJsonFluentAssert withTolerance​(double tolerance)
        Sets the tolerance for floating number comparison. If set to null, requires exact match of the values. For example, if set to 0.01, ignores all differences lower than 0.01, so 1 and 0.9999 are considered equal.
        Parameters:
        tolerance -
      • withTolerance

        public JsonFluentAssert.ConfigurableJsonFluentAssert withTolerance​(BigDecimal tolerance)
        Sets the tolerance for floating number comparison. If set to null, requires exact match of the values. For example, if set to 0.01, ignores all differences lower than 0.01, so 1 and 0.9999 are considered equal.
        Parameters:
        tolerance -
      • when

        public JsonFluentAssert.ConfigurableJsonFluentAssert when​(net.javacrumbs.jsonunit.core.Option firstOption,
                                                                  net.javacrumbs.jsonunit.core.Option... otherOptions)
        Sets options changing comparison behavior. This method has to be called before assertion. For more info see Option
        Parameters:
        firstOption -
        otherOptions -
        See Also:
        Option