use of cn.taketoday.web.client.RestTemplate in project today-infrastructure by TAKETODAY.
the class RestTemplateBuilderTests method defaultMessageConvertersShouldSetDefaultList.
@Test
void defaultMessageConvertersShouldSetDefaultList() {
RestTemplate template = new RestTemplate(Collections.singletonList(new StringHttpMessageConverter()));
this.builder.defaultMessageConverters().configure(template);
assertThat(template.getMessageConverters()).hasSameSizeAs(new RestTemplate().getMessageConverters());
}
use of cn.taketoday.web.client.RestTemplate in project today-infrastructure by TAKETODAY.
the class RestTemplateBuilderTests method customizersShouldBeAppliedLast.
@Test
void customizersShouldBeAppliedLast() {
RestTemplate template = spy(new RestTemplate());
this.builder.additionalCustomizers((restTemplate) -> verify(restTemplate).setRequestFactory(any(ClientHttpRequestFactory.class)));
this.builder.configure(template);
}
use of cn.taketoday.web.client.RestTemplate in project today-infrastructure by TAKETODAY.
the class RestTemplateBuilderTests method configureShouldApply.
@Test
void configureShouldApply() {
RestTemplate template = new RestTemplate();
this.builder.configure(template);
assertThat(template.getRequestFactory()).isInstanceOf(HttpComponentsClientHttpRequestFactory.class);
}
use of cn.taketoday.web.client.RestTemplate in project today-infrastructure by TAKETODAY.
the class RestTemplateBuilderTests method requestFactoryPackagePrivateClassShouldApply.
@Test
void requestFactoryPackagePrivateClassShouldApply() {
RestTemplate template = this.builder.requestFactory(TestClientHttpRequestFactory.class).build();
assertThat(template.getRequestFactory()).isInstanceOf(TestClientHttpRequestFactory.class);
}
use of cn.taketoday.web.client.RestTemplate in project today-infrastructure by TAKETODAY.
the class RestTemplateBuilderTests method errorHandlerShouldApply.
@Test
void errorHandlerShouldApply() {
ResponseErrorHandler errorHandler = mock(ResponseErrorHandler.class);
RestTemplate template = this.builder.errorHandler(errorHandler).build();
assertThat(template.getErrorHandler()).isSameAs(errorHandler);
}
Aggregations