Merge pull request #14830 from dreis2211

* pr/14830:
  Polish "Remove usages of BasicAuthorizationInterceptor"
  Remove usages of BasicAuthorizationInterceptor
This commit is contained in:
Stephane Nicoll
2018-10-16 10:22:08 +02:00
5 changed files with 58 additions and 33 deletions

View File

@@ -5914,7 +5914,7 @@ The following code shows a typical example:
TIP: `RestTemplateBuilder` includes a number of useful methods that can be used to TIP: `RestTemplateBuilder` includes a number of useful methods that can be used to
quickly configure a `RestTemplate`. For example, to add BASIC auth support, you can use quickly configure a `RestTemplate`. For example, to add BASIC auth support, you can use
`builder.basicAuthorization("user", "password").build()`. `builder.basicAuthentication("user", "password").build()`.

View File

@@ -51,7 +51,7 @@ import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.ClientHttpResponse; import org.springframework.http.client.ClientHttpResponse;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.http.client.InterceptingClientHttpRequestFactory; import org.springframework.http.client.InterceptingClientHttpRequestFactory;
import org.springframework.http.client.support.BasicAuthorizationInterceptor; import org.springframework.http.client.support.BasicAuthenticationInterceptor;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.ReflectionUtils; import org.springframework.util.ReflectionUtils;
import org.springframework.web.client.DefaultResponseErrorHandler; import org.springframework.web.client.DefaultResponseErrorHandler;
@@ -172,8 +172,8 @@ public class TestRestTemplate {
interceptors = Collections.emptyList(); interceptors = Collections.emptyList();
} }
interceptors = new ArrayList<>(interceptors); interceptors = new ArrayList<>(interceptors);
interceptors.removeIf(BasicAuthorizationInterceptor.class::isInstance); interceptors.removeIf(BasicAuthenticationInterceptor.class::isInstance);
interceptors.add(new BasicAuthorizationInterceptor(username, password)); interceptors.add(new BasicAuthenticationInterceptor(username, password));
restTemplate.setInterceptors(interceptors); restTemplate.setInterceptors(interceptors);
} }

View File

@@ -39,7 +39,7 @@ import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.http.client.InterceptingClientHttpRequestFactory; import org.springframework.http.client.InterceptingClientHttpRequestFactory;
import org.springframework.http.client.OkHttp3ClientHttpRequestFactory; import org.springframework.http.client.OkHttp3ClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory; import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.http.client.support.BasicAuthorizationInterceptor; import org.springframework.http.client.support.BasicAuthenticationInterceptor;
import org.springframework.mock.env.MockEnvironment; import org.springframework.mock.env.MockEnvironment;
import org.springframework.mock.http.client.MockClientHttpRequest; import org.springframework.mock.http.client.MockClientHttpRequest;
import org.springframework.mock.http.client.MockClientHttpResponse; import org.springframework.mock.http.client.MockClientHttpResponse;
@@ -371,7 +371,7 @@ public class TestRestTemplateTests {
"interceptors"); "interceptors");
assertThat(requestFactoryInterceptors).hasSize(1); assertThat(requestFactoryInterceptors).hasSize(1);
ClientHttpRequestInterceptor interceptor = requestFactoryInterceptors.get(0); ClientHttpRequestInterceptor interceptor = requestFactoryInterceptors.get(0);
assertThat(interceptor).isInstanceOf(BasicAuthorizationInterceptor.class); assertThat(interceptor).isInstanceOf(BasicAuthenticationInterceptor.class);
assertThat(interceptor).hasFieldOrPropertyWithValue("username", username); assertThat(interceptor).hasFieldOrPropertyWithValue("username", username);
assertThat(interceptor).hasFieldOrPropertyWithValue("password", password); assertThat(interceptor).hasFieldOrPropertyWithValue("password", password);

View File

@@ -33,7 +33,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.http.client.AbstractClientHttpRequestFactoryWrapper; import org.springframework.http.client.AbstractClientHttpRequestFactoryWrapper;
import org.springframework.http.client.ClientHttpRequestFactory; import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.ClientHttpRequestInterceptor; import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.support.BasicAuthorizationInterceptor; import org.springframework.http.client.support.BasicAuthenticationInterceptor;
import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@@ -74,7 +74,7 @@ public class RestTemplateBuilder {
private final ResponseErrorHandler errorHandler; private final ResponseErrorHandler errorHandler;
private final BasicAuthorizationInterceptor basicAuthorization; private final BasicAuthenticationInterceptor basicAuthentication;
private final Set<RestTemplateCustomizer> restTemplateCustomizers; private final Set<RestTemplateCustomizer> restTemplateCustomizers;
@@ -95,7 +95,7 @@ public class RestTemplateBuilder {
this.requestFactorySupplier = null; this.requestFactorySupplier = null;
this.uriTemplateHandler = null; this.uriTemplateHandler = null;
this.errorHandler = null; this.errorHandler = null;
this.basicAuthorization = null; this.basicAuthentication = null;
this.restTemplateCustomizers = Collections this.restTemplateCustomizers = Collections
.unmodifiableSet(new LinkedHashSet<>(Arrays.asList(customizers))); .unmodifiableSet(new LinkedHashSet<>(Arrays.asList(customizers)));
this.requestFactoryCustomizer = new RequestFactoryCustomizer(); this.requestFactoryCustomizer = new RequestFactoryCustomizer();
@@ -106,7 +106,7 @@ public class RestTemplateBuilder {
Set<HttpMessageConverter<?>> messageConverters, Set<HttpMessageConverter<?>> messageConverters,
Supplier<ClientHttpRequestFactory> requestFactorySupplier, Supplier<ClientHttpRequestFactory> requestFactorySupplier,
UriTemplateHandler uriTemplateHandler, ResponseErrorHandler errorHandler, UriTemplateHandler uriTemplateHandler, ResponseErrorHandler errorHandler,
BasicAuthorizationInterceptor basicAuthorization, BasicAuthenticationInterceptor basicAuthentication,
Set<RestTemplateCustomizer> restTemplateCustomizers, Set<RestTemplateCustomizer> restTemplateCustomizers,
RequestFactoryCustomizer requestFactoryCustomizer, RequestFactoryCustomizer requestFactoryCustomizer,
Set<ClientHttpRequestInterceptor> interceptors) { Set<ClientHttpRequestInterceptor> interceptors) {
@@ -116,7 +116,7 @@ public class RestTemplateBuilder {
this.requestFactorySupplier = requestFactorySupplier; this.requestFactorySupplier = requestFactorySupplier;
this.uriTemplateHandler = uriTemplateHandler; this.uriTemplateHandler = uriTemplateHandler;
this.errorHandler = errorHandler; this.errorHandler = errorHandler;
this.basicAuthorization = basicAuthorization; this.basicAuthentication = basicAuthentication;
this.restTemplateCustomizers = restTemplateCustomizers; this.restTemplateCustomizers = restTemplateCustomizers;
this.requestFactoryCustomizer = requestFactoryCustomizer; this.requestFactoryCustomizer = requestFactoryCustomizer;
this.interceptors = interceptors; this.interceptors = interceptors;
@@ -132,7 +132,7 @@ public class RestTemplateBuilder {
public RestTemplateBuilder detectRequestFactory(boolean detectRequestFactory) { public RestTemplateBuilder detectRequestFactory(boolean detectRequestFactory) {
return new RestTemplateBuilder(detectRequestFactory, this.rootUri, return new RestTemplateBuilder(detectRequestFactory, this.rootUri,
this.messageConverters, this.requestFactorySupplier, this.messageConverters, this.requestFactorySupplier,
this.uriTemplateHandler, this.errorHandler, this.basicAuthorization, this.uriTemplateHandler, this.errorHandler, this.basicAuthentication,
this.restTemplateCustomizers, this.requestFactoryCustomizer, this.restTemplateCustomizers, this.requestFactoryCustomizer,
this.interceptors); this.interceptors);
} }
@@ -146,7 +146,7 @@ public class RestTemplateBuilder {
public RestTemplateBuilder rootUri(String rootUri) { public RestTemplateBuilder rootUri(String rootUri) {
return new RestTemplateBuilder(this.detectRequestFactory, rootUri, return new RestTemplateBuilder(this.detectRequestFactory, rootUri,
this.messageConverters, this.requestFactorySupplier, this.messageConverters, this.requestFactorySupplier,
this.uriTemplateHandler, this.errorHandler, this.basicAuthorization, this.uriTemplateHandler, this.errorHandler, this.basicAuthentication,
this.restTemplateCustomizers, this.requestFactoryCustomizer, this.restTemplateCustomizers, this.requestFactoryCustomizer,
this.interceptors); this.interceptors);
} }
@@ -182,7 +182,7 @@ public class RestTemplateBuilder {
Collections.unmodifiableSet( Collections.unmodifiableSet(
new LinkedHashSet<HttpMessageConverter<?>>(messageConverters)), new LinkedHashSet<HttpMessageConverter<?>>(messageConverters)),
this.requestFactorySupplier, this.uriTemplateHandler, this.errorHandler, this.requestFactorySupplier, this.uriTemplateHandler, this.errorHandler,
this.basicAuthorization, this.restTemplateCustomizers, this.basicAuthentication, this.restTemplateCustomizers,
this.requestFactoryCustomizer, this.interceptors); this.requestFactoryCustomizer, this.interceptors);
} }
@@ -214,7 +214,7 @@ public class RestTemplateBuilder {
return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri, return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri,
append(this.messageConverters, messageConverters), append(this.messageConverters, messageConverters),
this.requestFactorySupplier, this.uriTemplateHandler, this.errorHandler, this.requestFactorySupplier, this.uriTemplateHandler, this.errorHandler,
this.basicAuthorization, this.restTemplateCustomizers, this.basicAuthentication, this.restTemplateCustomizers,
this.requestFactoryCustomizer, this.interceptors); this.requestFactoryCustomizer, this.interceptors);
} }
@@ -230,7 +230,7 @@ public class RestTemplateBuilder {
Collections.unmodifiableSet( Collections.unmodifiableSet(
new LinkedHashSet<>(new RestTemplate().getMessageConverters())), new LinkedHashSet<>(new RestTemplate().getMessageConverters())),
this.requestFactorySupplier, this.uriTemplateHandler, this.errorHandler, this.requestFactorySupplier, this.uriTemplateHandler, this.errorHandler,
this.basicAuthorization, this.restTemplateCustomizers, this.basicAuthentication, this.restTemplateCustomizers,
this.requestFactoryCustomizer, this.interceptors); this.requestFactoryCustomizer, this.interceptors);
} }
@@ -263,7 +263,7 @@ public class RestTemplateBuilder {
Assert.notNull(interceptors, "interceptors must not be null"); Assert.notNull(interceptors, "interceptors must not be null");
return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri, return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri,
this.messageConverters, this.requestFactorySupplier, this.messageConverters, this.requestFactorySupplier,
this.uriTemplateHandler, this.errorHandler, this.basicAuthorization, this.uriTemplateHandler, this.errorHandler, this.basicAuthentication,
this.restTemplateCustomizers, this.requestFactoryCustomizer, this.restTemplateCustomizers, this.requestFactoryCustomizer,
Collections.unmodifiableSet(new LinkedHashSet<>(interceptors))); Collections.unmodifiableSet(new LinkedHashSet<>(interceptors)));
} }
@@ -295,7 +295,7 @@ public class RestTemplateBuilder {
Assert.notNull(interceptors, "interceptors must not be null"); Assert.notNull(interceptors, "interceptors must not be null");
return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri, return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri,
this.messageConverters, this.requestFactorySupplier, this.messageConverters, this.requestFactorySupplier,
this.uriTemplateHandler, this.errorHandler, this.basicAuthorization, this.uriTemplateHandler, this.errorHandler, this.basicAuthentication,
this.restTemplateCustomizers, this.requestFactoryCustomizer, this.restTemplateCustomizers, this.requestFactoryCustomizer,
append(this.interceptors, interceptors)); append(this.interceptors, interceptors));
} }
@@ -337,7 +337,7 @@ public class RestTemplateBuilder {
"RequestFactory Supplier must not be null"); "RequestFactory Supplier must not be null");
return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri, return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri,
this.messageConverters, requestFactorySupplier, this.uriTemplateHandler, this.messageConverters, requestFactorySupplier, this.uriTemplateHandler,
this.errorHandler, this.basicAuthorization, this.restTemplateCustomizers, this.errorHandler, this.basicAuthentication, this.restTemplateCustomizers,
this.requestFactoryCustomizer, this.interceptors); this.requestFactoryCustomizer, this.interceptors);
} }
@@ -351,7 +351,7 @@ public class RestTemplateBuilder {
Assert.notNull(uriTemplateHandler, "UriTemplateHandler must not be null"); Assert.notNull(uriTemplateHandler, "UriTemplateHandler must not be null");
return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri, return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri,
this.messageConverters, this.requestFactorySupplier, uriTemplateHandler, this.messageConverters, this.requestFactorySupplier, uriTemplateHandler,
this.errorHandler, this.basicAuthorization, this.restTemplateCustomizers, this.errorHandler, this.basicAuthentication, this.restTemplateCustomizers,
this.requestFactoryCustomizer, this.interceptors); this.requestFactoryCustomizer, this.interceptors);
} }
@@ -365,23 +365,37 @@ public class RestTemplateBuilder {
Assert.notNull(errorHandler, "ErrorHandler must not be null"); Assert.notNull(errorHandler, "ErrorHandler must not be null");
return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri, return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri,
this.messageConverters, this.requestFactorySupplier, this.messageConverters, this.requestFactorySupplier,
this.uriTemplateHandler, errorHandler, this.basicAuthorization, this.uriTemplateHandler, errorHandler, this.basicAuthentication,
this.restTemplateCustomizers, this.requestFactoryCustomizer, this.restTemplateCustomizers, this.requestFactoryCustomizer,
this.interceptors); this.interceptors);
} }
/** /**
* Add HTTP basic authentication to requests. See * Add HTTP basic authentication to requests. See
* {@link BasicAuthorizationInterceptor} for details. * {@link BasicAuthenticationInterceptor} for details.
* @param username the user name * @param username the user name
* @param password the password * @param password the password
* @return a new builder instance * @return a new builder instance
* @deprecated since 2.1.0 in favor of
* {@link #basicAuthentication(String username, String password)}
*/ */
public RestTemplateBuilder basicAuthorization(String username, String password) { public RestTemplateBuilder basicAuthorization(String username, String password) {
return basicAuthentication(username, password);
}
/**
* Add HTTP basic authentication to requests. See
* {@link BasicAuthenticationInterceptor} for details.
* @param username the user name
* @param password the password
* @return a new builder instance
* @since 2.1.0
*/
public RestTemplateBuilder basicAuthentication(String username, String password) {
return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri, return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri,
this.messageConverters, this.requestFactorySupplier, this.messageConverters, this.requestFactorySupplier,
this.uriTemplateHandler, this.errorHandler, this.uriTemplateHandler, this.errorHandler,
new BasicAuthorizationInterceptor(username, password), new BasicAuthenticationInterceptor(username, password),
this.restTemplateCustomizers, this.requestFactoryCustomizer, this.restTemplateCustomizers, this.requestFactoryCustomizer,
this.interceptors); this.interceptors);
} }
@@ -417,7 +431,7 @@ public class RestTemplateBuilder {
"RestTemplateCustomizers must not be null"); "RestTemplateCustomizers must not be null");
return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri, return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri,
this.messageConverters, this.requestFactorySupplier, this.messageConverters, this.requestFactorySupplier,
this.uriTemplateHandler, this.errorHandler, this.basicAuthorization, this.uriTemplateHandler, this.errorHandler, this.basicAuthentication,
Collections.unmodifiableSet(new LinkedHashSet<RestTemplateCustomizer>( Collections.unmodifiableSet(new LinkedHashSet<RestTemplateCustomizer>(
restTemplateCustomizers)), restTemplateCustomizers)),
this.requestFactoryCustomizer, this.interceptors); this.requestFactoryCustomizer, this.interceptors);
@@ -451,7 +465,7 @@ public class RestTemplateBuilder {
Assert.notNull(customizers, "RestTemplateCustomizers must not be null"); Assert.notNull(customizers, "RestTemplateCustomizers must not be null");
return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri, return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri,
this.messageConverters, this.requestFactorySupplier, this.messageConverters, this.requestFactorySupplier,
this.uriTemplateHandler, this.errorHandler, this.basicAuthorization, this.uriTemplateHandler, this.errorHandler, this.basicAuthentication,
append(this.restTemplateCustomizers, customizers), append(this.restTemplateCustomizers, customizers),
this.requestFactoryCustomizer, this.interceptors); this.requestFactoryCustomizer, this.interceptors);
} }
@@ -465,7 +479,7 @@ public class RestTemplateBuilder {
public RestTemplateBuilder setConnectTimeout(Duration connectTimeout) { public RestTemplateBuilder setConnectTimeout(Duration connectTimeout) {
return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri, return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri,
this.messageConverters, this.requestFactorySupplier, this.messageConverters, this.requestFactorySupplier,
this.uriTemplateHandler, this.errorHandler, this.basicAuthorization, this.uriTemplateHandler, this.errorHandler, this.basicAuthentication,
this.restTemplateCustomizers, this.restTemplateCustomizers,
this.requestFactoryCustomizer.connectTimeout(connectTimeout), this.requestFactoryCustomizer.connectTimeout(connectTimeout),
this.interceptors); this.interceptors);
@@ -492,7 +506,7 @@ public class RestTemplateBuilder {
public RestTemplateBuilder setReadTimeout(Duration readTimeout) { public RestTemplateBuilder setReadTimeout(Duration readTimeout) {
return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri, return new RestTemplateBuilder(this.detectRequestFactory, this.rootUri,
this.messageConverters, this.requestFactorySupplier, this.messageConverters, this.requestFactorySupplier,
this.uriTemplateHandler, this.errorHandler, this.basicAuthorization, this.uriTemplateHandler, this.errorHandler, this.basicAuthentication,
this.restTemplateCustomizers, this.restTemplateCustomizers,
this.requestFactoryCustomizer.readTimeout(readTimeout), this.requestFactoryCustomizer.readTimeout(readTimeout),
this.interceptors); this.interceptors);
@@ -556,8 +570,8 @@ public class RestTemplateBuilder {
if (this.rootUri != null) { if (this.rootUri != null) {
RootUriTemplateHandler.addTo(restTemplate, this.rootUri); RootUriTemplateHandler.addTo(restTemplate, this.rootUri);
} }
if (this.basicAuthorization != null) { if (this.basicAuthentication != null) {
restTemplate.getInterceptors().add(this.basicAuthorization); restTemplate.getInterceptors().add(this.basicAuthentication);
} }
restTemplate.getInterceptors().addAll(this.interceptors); restTemplate.getInterceptors().addAll(this.interceptors);
if (!CollectionUtils.isEmpty(this.restTemplateCustomizers)) { if (!CollectionUtils.isEmpty(this.restTemplateCustomizers)) {

View File

@@ -34,7 +34,7 @@ import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.http.client.InterceptingClientHttpRequestFactory; import org.springframework.http.client.InterceptingClientHttpRequestFactory;
import org.springframework.http.client.OkHttp3ClientHttpRequestFactory; import org.springframework.http.client.OkHttp3ClientHttpRequestFactory;
import org.springframework.http.client.SimpleClientHttpRequestFactory; import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.http.client.support.BasicAuthorizationInterceptor; import org.springframework.http.client.support.BasicAuthenticationInterceptor;
import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.ResourceHttpMessageConverter; import org.springframework.http.converter.ResourceHttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter; import org.springframework.http.converter.StringHttpMessageConverter;
@@ -321,10 +321,21 @@ public class RestTemplateBuilderTests {
} }
@Test @Test
public void basicAuthenticationShouldApply() {
RestTemplate template = this.builder.basicAuthentication("spring", "boot")
.build();
ClientHttpRequestInterceptor interceptor = template.getInterceptors().get(0);
assertThat(interceptor).isInstanceOf(BasicAuthenticationInterceptor.class);
assertThat(interceptor).extracting("username").containsExactly("spring");
assertThat(interceptor).extracting("password").containsExactly("boot");
}
@Test
@Deprecated
public void basicAuthorizationShouldApply() { public void basicAuthorizationShouldApply() {
RestTemplate template = this.builder.basicAuthorization("spring", "boot").build(); RestTemplate template = this.builder.basicAuthorization("spring", "boot").build();
ClientHttpRequestInterceptor interceptor = template.getInterceptors().get(0); ClientHttpRequestInterceptor interceptor = template.getInterceptors().get(0);
assertThat(interceptor).isInstanceOf(BasicAuthorizationInterceptor.class); assertThat(interceptor).isInstanceOf(BasicAuthenticationInterceptor.class);
assertThat(interceptor).extracting("username").containsExactly("spring"); assertThat(interceptor).extracting("username").containsExactly("spring");
assertThat(interceptor).extracting("password").containsExactly("boot"); assertThat(interceptor).extracting("password").containsExactly("boot");
} }
@@ -400,11 +411,11 @@ public class RestTemplateBuilderTests {
ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
this.builder.interceptors(this.interceptor) this.builder.interceptors(this.interceptor)
.messageConverters(this.messageConverter).rootUri("http://localhost:8080") .messageConverters(this.messageConverter).rootUri("http://localhost:8080")
.errorHandler(errorHandler).basicAuthorization("spring", "boot") .errorHandler(errorHandler).basicAuthentication("spring", "boot")
.requestFactory(() -> requestFactory).customizers((restTemplate) -> { .requestFactory(() -> requestFactory).customizers((restTemplate) -> {
assertThat(restTemplate.getInterceptors()).hasSize(2) assertThat(restTemplate.getInterceptors()).hasSize(2)
.contains(this.interceptor).anyMatch( .contains(this.interceptor).anyMatch(
(ic) -> ic instanceof BasicAuthorizationInterceptor); (ic) -> ic instanceof BasicAuthenticationInterceptor);
assertThat(restTemplate.getMessageConverters()) assertThat(restTemplate.getMessageConverters())
.contains(this.messageConverter); .contains(this.messageConverter);
assertThat(restTemplate.getUriTemplateHandler()) assertThat(restTemplate.getUriTemplateHandler())