Interface LocationAwareValueMatcher<T>

Type Parameters:
T - Generic Type
All Superinterfaces:
ValueMatcher<T>
All Known Implementing Classes:
ArrayValueMatcher

public interface LocationAwareValueMatcher<T> extends ValueMatcher<T>
A ValueMatcher extension that provides location in form of prefix to the equals method.
Author:
Duncan Mackinder
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equal(String prefix, T actual, T expected, JSONCompareResult result)
    Match actual value with expected value.

    Methods inherited from interface org.skyscreamer.jsonassert.ValueMatcher

    equal
  • Method Details

    • equal

      boolean equal(String prefix, T actual, T expected, JSONCompareResult result) throws ValueMatcherException
      Match actual value with expected value. If match fails any of the following may occur, return false, pass failure details to specified JSONCompareResult and return true, or throw ValueMatcherException containing failure details. Passing failure details to JSONCompareResult or returning via ValueMatcherException enables more useful failure description for cases where expected value depends entirely or in part on configuration of the ValueMatcher and therefore expected value passed to this method will not give a useful indication of expected value.
      Parameters:
      prefix - JSON path of the JSON item being tested
      actual - JSON value being tested
      expected - expected JSON value
      result - JSONCompareResult to which match failure may be passed
      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.