Class Configuration


  • public class Configuration
    extends Object
    Comparison configuration. Immutable.
    • Method Detail

      • empty

        public static Configuration empty()
        Returns an empty configuration.
        Returns:
      • withTolerance

        public Configuration withTolerance​(BigDecimal tolerance)
        Sets numerical comparison tolerance.
        Parameters:
        tolerance -
        Returns:
      • withTolerance

        public Configuration withTolerance​(double tolerance)
        Sets numerical comparison tolerance.
        Parameters:
        tolerance -
        Returns:
      • when

        public Configuration when​(Option first,
                                  Option... next)
        Adds comparison options.
        Parameters:
        first -
        next -
        Returns:
      • withOptions

        public Configuration withOptions​(Option first,
                                         Option... next)
        Adds comparison options.
        Parameters:
        first -
        next -
        Returns:
      • withOptions

        public Configuration withOptions​(Options options)
        Sets comparison options.
        Parameters:
        options -
        Returns:
      • whenIgnoringPaths

        public Configuration 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 Configuration withIgnorePlaceholder​(String ignorePlaceholder)
        Sets ignore placeholder.
        Parameters:
        ignorePlaceholder -
        Returns:
      • withMatcher

        public Configuration withMatcher​(String matcherName,
                                         org.hamcrest.Matcher<?> matcher)
        Adds a matcher to be used in ${json-unit.matches:matcherName} macro.
        Parameters:
        matcherName -
        matcher -
        Returns:
      • getMatcher

        public org.hamcrest.Matcher<?> getMatcher​(String matcherName)
      • getOptions

        public Options getOptions()
      • getIgnorePlaceholder

        public String getIgnorePlaceholder()
      • getPathsToBeIgnored

        public Set<String> getPathsToBeIgnored()
      • shouldIgnore

        public boolean shouldIgnore​(String expectedValue)