Class RawBodyRequestMatcher

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

    public class RawBodyRequestMatcher
    extends RequestMatcher<byte[]>
    A RequestMatcher used for matching the request body as an array of bytes.
    • Constructor Detail

      • RawBodyRequestMatcher

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

      • requestRawBody

        public static RawBodyRequestMatcher requestRawBody​(org.hamcrest.Matcher<byte[]> 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 byte[] retrieveValue​(Request req)
                                throws Exception
        Retrieves the body of the given request
        Specified by:
        retrieveValue in class RequestMatcher<byte[]>
        Parameters:
        req - request to retrieve the body from
        Returns:
        request body as an array of bytes (never returns null)
        Throws:
        Exception - when something goes wrong. This exception will be handler correctly by Jadler.