Class MockClientHttpRequest
java.lang.Object
org.springframework.mock.http.MockHttpOutputMessage
org.springframework.mock.http.client.MockClientHttpRequest
- All Implemented Interfaces:
org.springframework.http.client.ClientHttpRequest,org.springframework.http.HttpMessage,org.springframework.http.HttpOutputMessage,org.springframework.http.HttpRequest
public class MockClientHttpRequest
extends MockHttpOutputMessage
implements org.springframework.http.client.ClientHttpRequest
Mock implementation of
ClientHttpRequest.- Since:
- 3.2
- Author:
- Rossen Stoyanchev, Sam Brannen
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.MockClientHttpRequest(org.springframework.http.HttpMethod httpMethod, URI uri) Create an instance with the given HttpMethod and URI. -
Method Summary
Modifier and TypeMethodDescriptionfinal org.springframework.http.client.ClientHttpResponseexecute()protected org.springframework.http.client.ClientHttpResponseThe default implementation returns the configuredresponse.org.springframework.http.HttpMethodgetURI()booleanvoidsetMethod(org.springframework.http.HttpMethod httpMethod) voidsetResponse(org.springframework.http.client.ClientHttpResponse clientHttpResponse) voidtoString()Methods inherited from class org.springframework.mock.http.MockHttpOutputMessage
getBody, getBodyAsBytes, getBodyAsString, getBodyAsString, getHeadersMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.http.HttpMessage
getHeadersMethods inherited from interface org.springframework.http.HttpOutputMessage
getBodyMethods inherited from interface org.springframework.http.HttpRequest
getMethodValue
-
Constructor Details
-
MockClientHttpRequest
public MockClientHttpRequest()Default constructor. -
MockClientHttpRequest
Create an instance with the given HttpMethod and URI.
-
-
Method Details
-
setMethod
public void setMethod(org.springframework.http.HttpMethod httpMethod) -
getMethod
public org.springframework.http.HttpMethod getMethod()- Specified by:
getMethodin interfaceorg.springframework.http.HttpRequest
-
setURI
-
getURI
- Specified by:
getURIin interfaceorg.springframework.http.HttpRequest
-
setResponse
public void setResponse(org.springframework.http.client.ClientHttpResponse clientHttpResponse) -
isExecuted
public boolean isExecuted() -
execute
- Specified by:
executein interfaceorg.springframework.http.client.ClientHttpRequest- Throws:
IOException- See Also:
-
executeInternal
The default implementation returns the configuredresponse.Override this method to execute the request and provide a response, potentially different from the configured response.
- Throws:
IOException
-
toString
-