Package net.jadler.matchers
Class PathRequestMatcher
- java.lang.Object
-
- org.hamcrest.BaseMatcher<Request>
-
- net.jadler.matchers.RequestMatcher<String>
-
- net.jadler.matchers.PathRequestMatcher
-
- All Implemented Interfaces:
org.hamcrest.Matcher<Request>,org.hamcrest.SelfDescribing
public class PathRequestMatcher extends RequestMatcher<String>
ARequestMatcherused for matching the request path.
-
-
Field Summary
-
Fields inherited from class net.jadler.matchers.RequestMatcher
pred
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPathRequestMatcher(org.hamcrest.Matcher<? super String> pred)Protected constructor useful only when subtyping.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringprovideDescription()Provides a description of this matcher in form of a string consisting of "noun verb", where noun describes the value retrieved usingRequestMatcher.retrieveValue(net.jadler.Request)and verb is usually a correct form of to be.static PathRequestMatcherrequestPath(org.hamcrest.Matcher<? super String> pred)Factory method to create new instance of this matcher.StringretrieveValue(Request req)Retrieves the path of the given request.-
Methods inherited from class net.jadler.matchers.RequestMatcher
describeMismatch, describeTo, matches
-
-
-
-
Constructor Detail
-
PathRequestMatcher
protected PathRequestMatcher(org.hamcrest.Matcher<? super String> pred)
Protected constructor useful only when subtyping. For creating instances of this class userequestPath(org.hamcrest.Matcher)instead.- Parameters:
pred- a predicate to be applied on the request path
-
-
Method Detail
-
requestPath
public static PathRequestMatcher requestPath(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 path- Returns:
- new instance of this matcher
-
retrieveValue
public String retrieveValue(Request req)
Retrieves the path of the given request. The value is percent-encoded.- Specified by:
retrieveValuein classRequestMatcher<String>- Parameters:
req- request to retrieve the path from- Returns:
- request path (never returns
null)
-
provideDescription
protected String provideDescription()
Provides a description of this matcher in form of a string consisting of "noun verb", where noun describes the value retrieved using
RequestMatcher.retrieveValue(net.jadler.Request)and verb is usually a correct form of to be.If the
RequestMatcher.retrieveValue(net.jadler.Request)provided a request method, this method would return method is string for example.- Specified by:
provideDescriptionin classRequestMatcher<String>- Returns:
- matcher description
-
-