use of org.springframework.boot.test.web.client.LocalHostUriTemplateHandler in project spring-boot by spring-projects.
the class CorsSampleActuatorApplicationTests method setUp.
@BeforeEach
void setUp() {
RestTemplateBuilder builder = new RestTemplateBuilder();
LocalHostUriTemplateHandler handler = new LocalHostUriTemplateHandler(this.applicationContext.getEnvironment(), "http");
builder = builder.uriTemplateHandler(handler);
this.testRestTemplate = new TestRestTemplate(builder);
}
use of org.springframework.boot.test.web.client.LocalHostUriTemplateHandler in project spring-boot by spring-projects.
the class MetricsRestTemplateCustomizerTests method whenCustomizerAndLocalHostUriTemplateHandlerAreUsedTogetherThenRestTemplateBuilderCanBuild.
@Test
void whenCustomizerAndLocalHostUriTemplateHandlerAreUsedTogetherThenRestTemplateBuilderCanBuild() {
MockEnvironment environment = new MockEnvironment();
environment.setProperty("local.server.port", "8443");
LocalHostUriTemplateHandler uriTemplateHandler = new LocalHostUriTemplateHandler(environment, "https");
RestTemplate restTemplate = new RestTemplateBuilder(this.customizer).uriTemplateHandler(uriTemplateHandler).build();
assertThat(restTemplate.getUriTemplateHandler()).asInstanceOf(InstanceOfAssertFactories.type(RootUriTemplateHandler.class)).extracting(RootUriTemplateHandler::getRootUri).isEqualTo("https://localhost:8443");
}
use of org.springframework.boot.test.web.client.LocalHostUriTemplateHandler in project spring-boot by spring-projects.
the class CorsSampleActuatorApplicationTests method setUp.
@BeforeEach
void setUp() {
RestTemplateBuilder builder = new RestTemplateBuilder();
LocalHostUriTemplateHandler handler = new LocalHostUriTemplateHandler(this.applicationContext.getEnvironment(), "http");
builder = builder.uriTemplateHandler(handler);
this.testRestTemplate = new TestRestTemplate(builder);
}
Aggregations