use of org.springframework.test.web.client.MockRestServiceServer in project spring-boot by spring-projects.
the class RootUriRequestExpectationManagerTests method boundRestTemplateWhenUrlIncludesDomainShouldNotPrefixRootUri.
@Test
public void boundRestTemplateWhenUrlIncludesDomainShouldNotPrefixRootUri() {
RestTemplate restTemplate = new RestTemplateBuilder().rootUri("http://example.com").build();
MockRestServiceServer server = RootUriRequestExpectationManager.bindTo(restTemplate);
server.expect(requestTo("/hello")).andRespond(withSuccess());
this.thrown.expect(AssertionError.class);
this.thrown.expectMessage("expected:<http://example.com/hello> but was:<http://spring.io/hello>");
restTemplate.getForEntity("http://spring.io/hello", String.class);
}
Aggregations