Class QueryStringRequestMatcher

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

    public class QueryStringRequestMatcher
    extends RequestMatcher<String>
    A RequestMatcher used for matching the request query string.
    • Constructor Detail

      • QueryStringRequestMatcher

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

      • requestQueryString

        public static QueryStringRequestMatcher requestQueryString​(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 query string
        Returns:
        new instance of this matcher
      • retrieveValue

        public String retrieveValue​(Request req)
        Retrieves the query string value of the given request. The value is percent-encoded.
        Specified by:
        retrieveValue in class RequestMatcher<String>
        Parameters:
        req - request to retrieve the query string from
        Returns:
        query string value:
        • null for requests without a query string part (no ? character)
        • an empty string for request with an empty query string part (? is present but there is no actual query string value)
        • query string value (without the leading ? character) for requests with a query string part