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 c7274ad0f47..0203d3eee90 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()