use of org.springframework.web.client.RestTemplate in project spring-boot by spring-projects.
the class RestTemplateBuilderTests method uriTemplateHandlerShouldApply.
@Test
public void uriTemplateHandlerShouldApply() throws Exception {
UriTemplateHandler uriTemplateHandler = mock(UriTemplateHandler.class);
RestTemplate template = this.builder.uriTemplateHandler(uriTemplateHandler).build();
assertThat(template.getUriTemplateHandler()).isSameAs(uriTemplateHandler);
}
use of org.springframework.web.client.RestTemplate in project spring-boot by spring-projects.
the class RestTemplateBuilderTests method createWithCustomizersShouldApplyCustomizers.
@Test
public void createWithCustomizersShouldApplyCustomizers() throws Exception {
RestTemplateCustomizer customizer = mock(RestTemplateCustomizer.class);
RestTemplate template = new RestTemplateBuilder(customizer).build();
verify(customizer).customize(template);
}
use of org.springframework.web.client.RestTemplate in project spring-boot by spring-projects.
the class RestTemplateBuilderTests method additionalCustomizersShouldAddToExisting.
@Test
public void additionalCustomizersShouldAddToExisting() throws Exception {
RestTemplateCustomizer customizer1 = mock(RestTemplateCustomizer.class);
RestTemplateCustomizer customizer2 = mock(RestTemplateCustomizer.class);
RestTemplate template = this.builder.customizers(customizer1).additionalCustomizers(customizer2).build();
verify(customizer1).customize(template);
verify(customizer2).customize(template);
}
use of org.springframework.web.client.RestTemplate in project spring-boot by spring-projects.
the class RestTemplateBuilderTests method defaultMessageConvertersShouldClearExisting.
@Test
public void defaultMessageConvertersShouldClearExisting() throws Exception {
RestTemplate template = new RestTemplate(Collections.<HttpMessageConverter<?>>singletonList(new StringHttpMessageConverter()));
this.builder.additionalMessageConverters(this.messageConverter).defaultMessageConverters().configure(template);
assertThat(template.getMessageConverters()).hasSameSizeAs(new RestTemplate().getMessageConverters());
}
use of org.springframework.web.client.RestTemplate in project spring-boot by spring-projects.
the class RestTemplateBuilderTests method requestFactoryShouldApply.
@Test
public void requestFactoryShouldApply() throws Exception {
ClientHttpRequestFactory requestFactory = mock(ClientHttpRequestFactory.class);
RestTemplate template = this.builder.requestFactory(requestFactory).build();
assertThat(template.getRequestFactory()).isSameAs(requestFactory);
}
Aggregations