org.skyscreamer.jsonassert
Class Customization
java.lang.Object
org.skyscreamer.jsonassert.Customization
public final class Customization
- extends Object
Associates a custom matcher to a specific jsonpath.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Customization
public Customization(String path,
ValueMatcher<Object> comparator)
customization
public static Customization customization(String path,
ValueMatcher<Object> comparator)
appliesToPath
public boolean appliesToPath(String path)
matches
@Deprecated
public boolean matches(Object actual,
Object expected)
- 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.
Copyright © 2014. All Rights Reserved.