Class RootUriRequestExpectationManager

java.lang.Object
org.springframework.boot.test.web.client.RootUriRequestExpectationManager
All Implemented Interfaces:
RequestExpectationManager

public class RootUriRequestExpectationManager extends Object implements RequestExpectationManager
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);
 
Since:
1.4.0
Author:
Phillip Webb
See Also: