Class ExecutingResponseCreator
java.lang.Object
org.springframework.test.web.client.response.ExecutingResponseCreator
- All Implemented Interfaces:
- ResponseCreator
ResponseCreator that obtains the response by executing the request
 through a ClientHttpRequestFactory. This is useful in scenarios with
 multiple remote services where some need to be called rather than mocked.
 The ClientHttpRequestFactory is typically obtained from the
 RestTemplate before it is passed to MockRestServiceServer,
 in effect using the original factory rather than the test factory:
 
 ResponseCreator withActualResponse = new ExecutingResponseCreator(restTemplate);
 MockRestServiceServer server = MockRestServiceServer.bindTo(restTemplate).build();
 //...
 server.expect(requestTo("/foo")).andRespond(withSuccess());
 server.expect(requestTo("/bar")).andRespond(withActualResponse);
 - Since:
- 6.0.4
- Author:
- Simon Baslé
- 
Constructor SummaryConstructorsConstructorDescriptionExecutingResponseCreator(ClientHttpRequestFactory requestFactory) Create an instance with the givenClientHttpRequestFactory.
- 
Method SummaryModifier and TypeMethodDescriptioncreateResponse(@Nullable ClientHttpRequest request) Create a response for the given request.
- 
Constructor Details- 
ExecutingResponseCreatorCreate an instance with the givenClientHttpRequestFactory.- Parameters:
- requestFactory- the request factory to delegate to
 
 
- 
- 
Method Details- 
createResponseDescription copied from interface:ResponseCreatorCreate a response for the given request.- Specified by:
- createResponsein interface- ResponseCreator
- Parameters:
- request- the request
- Throws:
- IOException
 
 
-