Class MockRestResponse

java.lang.Object
org.apache.juneau.rest.client.RestResponse
org.apache.juneau.rest.mock.MockRestResponse
All Implemented Interfaces:
AutoCloseable, HttpMessage, HttpResponse

public class MockRestResponse extends RestResponse
A subclass of RestResponse with additional features for mocked testing.
See Also:
  • Constructor Details

  • 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 class RestResponse
      Returns:
      The body of the response.
    • consume

      Description copied from class: RestResponse
      Consumes the response body.

      This is equivalent to closing the input stream.

      Any exceptions thrown during close are logged but not propagated.

      Overrides:
      consume in class RestResponse
      Returns:
      This object.