Package net.javacrumbs.jsonunit.core
Class Configuration
- java.lang.Object
-
- net.javacrumbs.jsonunit.core.Configuration
-
public class Configuration extends Object
Comparison configuration. Immutable.
-
-
Constructor Summary
Constructors Constructor Description Configuration(BigDecimal tolerance, Options options, String ignorePlaceholder)Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DifferenceListenerdummyDifferenceListener()static Configurationempty()Returns an empty configuration.DifferenceListenergetDifferenceListener()StringgetIgnorePlaceholder()org.hamcrest.Matcher<?>getMatcher(String matcherName)OptionsgetOptions()Set<String>getPathsToBeIgnored()BigDecimalgetTolerance()booleanshouldIgnore(String expectedValue)Configurationwhen(Option first, Option... next)Adds comparison options.ConfigurationwhenIgnoringPaths(String... pathsToBeIgnored)ConfigurationwithDifferenceListener(DifferenceListener differenceListener)Sets difference listenerConfigurationwithIgnorePlaceholder(String ignorePlaceholder)Sets ignore placeholder.ConfigurationwithMatcher(String matcherName, org.hamcrest.Matcher<?> matcher)Adds a matcher to be used in ${json-unit.matches:matcherName} macro.ConfigurationwithOptions(Options options)Sets comparison options.ConfigurationwithOptions(Option first, Option... next)Adds comparison options.ConfigurationwithTolerance(double tolerance)Sets numerical comparison tolerance.ConfigurationwithTolerance(BigDecimal tolerance)Sets numerical comparison tolerance.
-
-
-
Constructor Detail
-
Configuration
@Deprecated public Configuration(BigDecimal tolerance, Options options, String ignorePlaceholder)
Deprecated.
-
-
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)
-
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:
-
withDifferenceListener
public Configuration withDifferenceListener(DifferenceListener differenceListener)
Sets difference listener
-
dummyDifferenceListener
public static DifferenceListener dummyDifferenceListener()
-
getMatcher
public org.hamcrest.Matcher<?> getMatcher(String matcherName)
-
getTolerance
public BigDecimal getTolerance()
-
getOptions
public Options getOptions()
-
getIgnorePlaceholder
public String getIgnorePlaceholder()
-
getDifferenceListener
public DifferenceListener getDifferenceListener()
-
shouldIgnore
public boolean shouldIgnore(String expectedValue)
-
-