Class PathBodyMatcher

java.lang.Object
org.springframework.cloud.contract.spec.internal.PathBodyMatcher
All Implemented Interfaces:
BodyMatcher

public class PathBodyMatcher extends Object implements BodyMatcher
Author:
Marcin Grzejszczak
  • Method Details

    • matchingType

      public MatchingType matchingType()
      Specified by:
      matchingType in interface BodyMatcher
      Returns:
      What kind of matching are we dealing with.
    • path

      public String path()
      Specified by:
      path in interface BodyMatcher
      Returns:
      Path to the path. Example for JSON it will be JSON Path.
    • value

      public Object value()
      Specified by:
      value in interface BodyMatcher
      Returns:
      Optional value that the given path should be checked against. If there is no value then presence will be checked only together with type check. Example if we expect a JSON Path path $.a to be matched. by type, the defined response body contained an integer but the actual one contained a string then the assertion should fail.
    • minTypeOccurrence

      public Integer minTypeOccurrence()
      Specified by:
      minTypeOccurrence in interface BodyMatcher
      Returns:
      Min no of occurrence when matching by type. In all other cases it will be ignored.
    • maxTypeOccurrence

      public Integer maxTypeOccurrence()
      Specified by:
      maxTypeOccurrence in interface BodyMatcher
      Returns:
      Max no of occurrence when matching by type. In all other cases it will be ignored.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object