Package org.apache.juneau.rest.mock
Class MockRestResponse
java.lang.Object
org.apache.juneau.rest.client.RestResponse
org.apache.juneau.rest.mock.MockRestResponse
- All Implemented Interfaces:
HttpMessage
,HttpResponse
-
Constructor Summary
ConstructorDescriptionMockRestResponse
(RestClient client, RestRequest request, HttpResponse response, Parser parser) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionCaches the response body so that it can be read as a stream multiple times.consume()
Consumes the response body.Methods inherited from class org.apache.juneau.rest.client.RestResponse
addHeader, addHeader, assertCharset, assertContent, assertContent, assertContentMatches, assertHeader, assertStatus, assertStatus, containsHeader, getAllHeaders, getCharacterEncoding, getContent, getContentType, getEntity, getFirstHeader, getHeader, getHeaders, getLastHeader, getLocale, getParams, getPartParserSession, getPartParserSession, getProtocolVersion, getReasonPhrase, getRequest, getStatusCode, getStatusLine, getStringHeader, headerIterator, headerIterator, log, log, removeHeader, removeHeaders, setEntity, setHeader, setHeader, setHeaders, setLocale, setParams, setReasonPhrase, setStatusCode, setStatusLine, setStatusLine, setStatusLine
-
Constructor Details
-
MockRestResponse
public MockRestResponse(RestClient client, RestRequest request, HttpResponse response, Parser parser) Constructor.- Parameters:
client
- The RestClient that created this response.request
- The REST request.response
- The HTTP response. Can benull .parser
- The overridden parser passed intoRestRequest.parser(Parser)
.
-
-
Method Details
-
cacheContent
Description copied from class:RestResponse
Caches the response body so that it can be read as a stream multiple times. This is equivalent to calling the following:getContent().cache();
- Overrides:
cacheContent
in classRestResponse
- Returns:
- The body of the response.
-
consume
Description copied from class:RestResponse
Consumes the response body.This is equivalent to closing the input stream.
- Overrides:
consume
in classRestResponse
- Returns:
- This object.
- Throws:
RestCallException
- If one of theRestCallInterceptors
threw an exception.
-