public class Exchange extends Object
| Constructor and Description |
|---|
Exchange(org.springframework.http.RequestEntity<org.json.JSONObject> request,
org.springframework.http.ResponseEntity<org.json.JSONObject> response) |
Exchange(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(Object o) |
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() |
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 CharSequence> |
header(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.
|
String |
toString() |
static com.google.common.base.Predicate<org.springframework.http.RequestEntity<org.json.JSONObject>> |
url(com.google.common.base.Predicate<? super CharSequence> stringPredicate)
Predicate that applies to the request URL.
|
static com.google.common.base.Predicate<Exchange> |
withId(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(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 String getTimestamp()
x-client-timestamp header.public 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(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 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 CharSequence> com.google.common.base.Predicate<T> header(String key, com.google.common.base.Predicate<U> stringPredicate)
key - keystringPredicate - stringPredicatepublic static void assertSameExchange(Exchange expected, Exchange actual)
expected - expectedactual - actualCopyright © 2016–2018. All rights reserved.