From 1e6851cf81a482a32f320f189f7b607e7fb82dd7 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Tue, 16 Oct 2018 10:19:08 +0200 Subject: [PATCH] Polish "Remove usages of BasicAuthorizationInterceptor" Closes gh-14830 --- .../boot/web/client/RestTemplateBuilderTests.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java index c7274ad0f4..0203d3eee9 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/client/RestTemplateBuilderTests.java @@ -330,6 +330,16 @@ public class RestTemplateBuilderTests { assertThat(interceptor).extracting("password").containsExactly("boot"); } + @Test + @Deprecated + public void basicAuthorizationShouldApply() { + RestTemplate template = this.builder.basicAuthorization("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 public void customizersWhenCustomizersAreNullShouldThrowException() { assertThatIllegalArgumentException()