public class Exchange
extends java.lang.Object
| Constructor and Description |
|---|
Exchange(org.springframework.http.RequestEntity<org.json.JSONObject> request,
org.springframework.http.ResponseEntity<org.json.JSONObject> response) |
Exchange(java.lang.String urlPrefix,
org.json.JSONObject json) |
| Modifier and Type | Method and Description |
|---|---|
static void |
assertSameExchange(Exchange expected,
Exchange actual)
Convenience method for unit tests.
|
static <T extends org.springframework.http.HttpEntity<org.json.JSONObject>> |
body(com.jayway.jsonpath.Predicate bodyPredicate)
Predicate that applies to a request or response body.
|
boolean |
equals(java.lang.Object o) |
java.lang.String |
getId()
Convenience method to retrieve the
x-request-id header. |
org.springframework.http.RequestEntity<org.json.JSONObject> |
getRequest() |
org.springframework.http.ResponseEntity<org.json.JSONObject> |
getResponse() |
java.lang.String |
getTimestamp()
Convenience method to retrieve the
x-client-timestamp header. |
int |
hashCode() |
static <T extends org.springframework.http.HttpEntity<org.json.JSONObject>,U extends java.lang.CharSequence> |
header(java.lang.String key,
com.google.common.base.Predicate<U> stringPredicate)
Predicate that applies to a given request or response header.
|
static <T extends org.springframework.http.HttpEntity<org.json.JSONObject>> |
headers(com.google.common.base.Predicate<org.springframework.http.HttpHeaders> headersPredicate)
Predicate that applies to request or response headers.
|
static com.google.common.base.Predicate<org.springframework.http.RequestEntity<org.json.JSONObject>> |
method(com.google.common.base.Predicate<org.springframework.http.HttpMethod> methodPredicate)
Predicate that applies to the request HTTP method.
|
static com.google.common.base.Predicate<Exchange> |
request(com.google.common.base.Predicate<? super org.springframework.http.RequestEntity<org.json.JSONObject>> requestPredicate)
Predicate that applies to the request part.
|
static com.google.common.base.Predicate<Exchange> |
response(com.google.common.base.Predicate<? super org.springframework.http.ResponseEntity<org.json.JSONObject>> responsePredicate)
Predicate that applies to the response part.
|
void |
setRequest(org.springframework.http.RequestEntity<org.json.JSONObject> request) |
void |
setResponse(org.springframework.http.ResponseEntity<org.json.JSONObject> response) |
static com.google.common.base.Predicate<org.springframework.http.ResponseEntity<org.json.JSONObject>> |
status(com.google.common.base.Predicate<org.springframework.http.HttpStatus> statusPredicate)
Predicate that applies to the response HTTP status code.
|
java.lang.String |
toString() |
static com.google.common.base.Predicate<org.springframework.http.RequestEntity<org.json.JSONObject>> |
url(com.google.common.base.Predicate<? super java.lang.CharSequence> stringPredicate)
Predicate that applies to the request URL.
|
static com.google.common.base.Predicate<Exchange> |
withId(java.lang.String... requestIds)
Predicate matching exchanges having one of the specified
x-request-id header. |
public Exchange(org.springframework.http.RequestEntity<org.json.JSONObject> request,
org.springframework.http.ResponseEntity<org.json.JSONObject> response)
public Exchange(java.lang.String urlPrefix,
org.json.JSONObject json)
urlPrefix - A prefix added to the request URI.json - Source exchange in JSON form.public org.springframework.http.RequestEntity<org.json.JSONObject> getRequest()
public void setRequest(org.springframework.http.RequestEntity<org.json.JSONObject> request)
public org.springframework.http.ResponseEntity<org.json.JSONObject> getResponse()
public void setResponse(org.springframework.http.ResponseEntity<org.json.JSONObject> response)
public java.lang.String getTimestamp()
x-client-timestamp header.public java.lang.String getId()
x-request-id header.public static com.google.common.base.Predicate<Exchange> request(com.google.common.base.Predicate<? super org.springframework.http.RequestEntity<org.json.JSONObject>> requestPredicate)
requestPredicate - requestPredicatepublic static com.google.common.base.Predicate<Exchange> response(com.google.common.base.Predicate<? super org.springframework.http.ResponseEntity<org.json.JSONObject>> responsePredicate)
responsePredicate - responsePredicatepublic static com.google.common.base.Predicate<Exchange> withId(java.lang.String... requestIds)
x-request-id header.requestIds - requestIdspublic static com.google.common.base.Predicate<org.springframework.http.RequestEntity<org.json.JSONObject>> url(com.google.common.base.Predicate<? super java.lang.CharSequence> stringPredicate)
stringPredicate - stringPredicatepublic static com.google.common.base.Predicate<org.springframework.http.RequestEntity<org.json.JSONObject>> method(com.google.common.base.Predicate<org.springframework.http.HttpMethod> methodPredicate)
methodPredicate - methodPredicatepublic static com.google.common.base.Predicate<org.springframework.http.ResponseEntity<org.json.JSONObject>> status(com.google.common.base.Predicate<org.springframework.http.HttpStatus> statusPredicate)
statusPredicate - statusPredicatepublic static <T extends org.springframework.http.HttpEntity<org.json.JSONObject>> com.google.common.base.Predicate<T> body(com.jayway.jsonpath.Predicate bodyPredicate)
bodyPredicate - bodyPredicatepublic static <T extends org.springframework.http.HttpEntity<org.json.JSONObject>> com.google.common.base.Predicate<T> headers(com.google.common.base.Predicate<org.springframework.http.HttpHeaders> headersPredicate)
headersPredicate - headersPredicatepublic static <T extends org.springframework.http.HttpEntity<org.json.JSONObject>,U extends java.lang.CharSequence> com.google.common.base.Predicate<T> header(java.lang.String key,
com.google.common.base.Predicate<U> stringPredicate)
key - keystringPredicate - stringPredicatepublic static void assertSameExchange(Exchange expected, Exchange actual)
expected - expectedactual - actualpublic java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Object