Class BodyRequestMatcher

  • All Implemented Interfaces:
    org.hamcrest.Matcher<Request>, org.hamcrest.SelfDescribing

    public class BodyRequestMatcher
    extends RequestMatcher<String>
    A RequestMatcher used for matching the request body as a string.
    • Constructor Detail

      • BodyRequestMatcher

        protected BodyRequestMatcher​(org.hamcrest.Matcher<? super String> pred)
        Protected constructor useful only when subtyping. For creating instances of this class use requestBody(org.hamcrest.Matcher) instead.
        Parameters:
        pred - a predicate to be applied on the request body
    • Method Detail

      • requestBody

        public static BodyRequestMatcher requestBody​(org.hamcrest.Matcher<? super String> pred)
        Factory method to create new instance of this matcher.
        Parameters:
        pred - a predicate to be applied on the request body
        Returns:
        new instance of this matcher
      • retrieveValue

        protected String retrieveValue​(Request req)
        Retrieves the body of the given request
        Specified by:
        retrieveValue in class RequestMatcher<String>
        Parameters:
        req - request to retrieve the body from
        Returns:
        request body as a string (never returns null)