public class MockClientHttpRequest extends MockHttpOutputMessage implements ClientHttpRequest
ClientHttpRequest
.Constructor and Description |
---|
MockClientHttpRequest()
Default constructor.
|
MockClientHttpRequest(HttpMethod httpMethod,
java.net.URI uri)
Create an instance with the given HttpMethod and URI.
|
Modifier and Type | Method and Description |
---|---|
ClientHttpResponse |
execute()
|
protected ClientHttpResponse |
executeInternal()
The default implementation returns the configured
response . |
HttpMethod |
getMethod()
Return the HTTP method of the request.
|
java.net.URI |
getURI()
Return the URI of the request (including a query string if any,
but only if it is well-formed for a URI representation).
|
boolean |
isExecuted() |
void |
setMethod(HttpMethod httpMethod) |
void |
setResponse(ClientHttpResponse clientHttpResponse) |
void |
setURI(java.net.URI uri) |
java.lang.String |
toString() |
getBody, getBodyAsBytes, getBodyAsString, getBodyAsString, getHeaders
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getBody
getHeaders
public MockClientHttpRequest()
public MockClientHttpRequest(HttpMethod httpMethod, java.net.URI uri)
public void setMethod(HttpMethod httpMethod)
public HttpMethod getMethod()
HttpRequest
getMethod
in interface HttpRequest
null
if not resolvable (e.g. in case of a non-standard HTTP method)public void setURI(java.net.URI uri)
public java.net.URI getURI()
HttpRequest
getURI
in interface HttpRequest
null
)public void setResponse(ClientHttpResponse clientHttpResponse)
public boolean isExecuted()
public final ClientHttpResponse execute() throws java.io.IOException
execute
in interface ClientHttpRequest
java.io.IOException
- in case of I/O errorsexecuteInternal()
protected ClientHttpResponse executeInternal() throws java.io.IOException
response
.
Override this method to execute the request and provide a response, potentially different than the configured response.
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object