RootUriRequestExpectationManager
RequestExpectationManager that strips the specified root URI from the request before verification. Can be used to simply test declarations when all REST calls start the same way. For example:
RestTemplate restTemplate = new RestTemplateBuilder().rootUri("https://example.com").build();
MockRestServiceServer server = RootUriRequestExpectationManager.bindTo(restTemplate);
server.expect(requestTo("/hello")).andRespond(withSuccess());
restTemplate.getForEntity("/hello", String.class);
Content copied to clipboard
Author
Phillip Webb
Since
1.4.0
See also
Functions
Link copied to clipboard
open fun bindTo(restTemplate: RestTemplate, expectationManager: RequestExpectationManager): MockRestServiceServer
Return a bound MockRestServiceServer for the given RestTemplate, configured with RootUriRequestExpectationManager when possible.
Link copied to clipboard
Link copied to clipboard
open fun forRestTemplate(restTemplate: RestTemplate, expectationManager: RequestExpectationManager): RequestExpectationManager
Return RequestExpectationManager to be used for binding with the specified RestTemplate.
Link copied to clipboard