Package org.skyscreamer.jsonassert
Class Customization
java.lang.Object
org.skyscreamer.jsonassert.Customization
Associates a custom matcher to a specific jsonpath.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
appliesToPath
(String path) static Customization
customization
(String path, ValueMatcher<Object> comparator) boolean
Deprecated.boolean
matches
(String prefix, Object actual, Object expected, JSONCompareResult result) Return true if actual value matches expected value using this Customization's comparator.
-
Constructor Details
-
Customization
-
-
Method Details
-
customization
- Parameters:
path
- the json pathcomparator
- the comparator- Returns:
- a new Customization
-
appliesToPath
-
matches
Deprecated.Return true if actual value matches expected value using this Customization's comparator. Calls to this method should be replaced by calls to matches(String prefix, Object actual, Object expected, JSONCompareResult result).- Parameters:
actual
- JSON value being testedexpected
- expected JSON value- Returns:
- true if actual value matches expected value
-
matches
public boolean matches(String prefix, Object actual, Object expected, JSONCompareResult result) throws ValueMatcherException Return true if actual value matches expected value using this Customization's comparator. The equal method used for comparison depends on type of comparator.- Parameters:
prefix
- JSON path of the JSON item being tested (only used if comparator is a LocationAwareValueMatcher)actual
- JSON value being testedexpected
- expected JSON valueresult
- JSONCompareResult to which match failure may be passed (only used if comparator is a LocationAwareValueMatcher)- Returns:
- true if expected and actual equal or any difference has already been passed to specified result instance, false otherwise.
- Throws:
ValueMatcherException
- if expected and actual values not equal and ValueMatcher needs to override default comparison failure message that would be generated if this method returned false.
-