T
- type of the value retrieved from the given request to be matchedpublic abstract class RequestMatcher<T> extends org.hamcrest.BaseMatcher<Request>
Modifier and Type | Field and Description |
---|---|
protected org.hamcrest.Matcher<? super T> |
pred |
Modifier | Constructor and Description |
---|---|
protected |
RequestMatcher(org.hamcrest.Matcher<? super T> pred) |
Modifier and Type | Method and Description |
---|---|
void |
describeMismatch(Object item,
org.hamcrest.Description description) |
void |
describeTo(org.hamcrest.Description description) |
boolean |
matches(Object o)
Checks whether the given
Request object matches this matcher. |
protected abstract String |
provideDescription()
Provides a description of this matcher in form of a string consisting of "noun verb", where
noun describes the value retrieved using
retrieveValue(net.jadler.Request) and verb is usually a correct
form of to be. |
protected abstract T |
retrieveValue(Request req)
Reads a value of the given request object (the value can be anything retrievable from the request
object: method, header, body,...).
|
protected final org.hamcrest.Matcher<? super T> pred
protected RequestMatcher(org.hamcrest.Matcher<? super T> pred)
pred
- predicate to be applied on the value retrieved from the given request (cannot be null
)public void describeMismatch(Object item, org.hamcrest.Description description)
public void describeTo(org.hamcrest.Description description)
public boolean matches(Object o)
Request
object matches this matcher.o
- Request
object to be matched by this matcher. If this param is not of type Request
this
method will always return false
.true
if the value retrieved using retrieveValue(net.jadler.Request)
from the given
Request
object matches the predicate registered by the RequestMatcher(org.hamcrest.Matcher)
,
otherwise false
.protected abstract T retrieveValue(Request req) throws Exception
req
- request object to read a value fromException
- when something goes wrong. This exception will be handler correctly by Jadler.protected abstract String provideDescription()
Provides a description of this matcher in form of a string consisting of "noun verb", where
noun describes the value retrieved using retrieveValue(net.jadler.Request)
and verb is usually a correct
form of to be.
If the retrieveValue(net.jadler.Request)
provided a request method, this method would return
method is string for example.
Copyright © 2016. All Rights Reserved.