From d0918f87b2200e36d5a367b39f76434c3e705e18 Mon Sep 17 00:00:00 2001 From: dreis2211 Date: Tue, 24 Jul 2018 08:34:49 +0200 Subject: [PATCH] Fix OAuth2WebSecurityConfigurationTests Closes gh-13872 --- .../OAuth2WebSecurityConfigurationTests.java | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2WebSecurityConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2WebSecurityConfigurationTests.java index d6803ce5d0..36990dcb8b 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2WebSecurityConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/servlet/OAuth2WebSecurityConfigurationTests.java @@ -85,12 +85,8 @@ public class OAuth2WebSecurityConfigurationTests { public void configurationRegistersAuthorizedClientServiceBean() { this.contextRunner.withUserConfiguration(ClientRepositoryConfiguration.class, OAuth2WebSecurityConfiguration.class).run((context) -> { - OAuth2AuthorizedClientService bean = context - .getBean(OAuth2AuthorizedClientService.class); - OAuth2AuthorizedClientService authorizedClientService = (OAuth2AuthorizedClientService) ReflectionTestUtils - .getField(getAuthCodeFilters(context).get(0), - "authorizedClientService"); - assertThat(authorizedClientService).isEqualTo(bean); + assertThat(context) + .hasSingleBean(OAuth2AuthorizedClientService.class); }); } @@ -110,12 +106,9 @@ public class OAuth2WebSecurityConfigurationTests { .withUserConfiguration(OAuth2AuthorizedClientServiceConfiguration.class, OAuth2WebSecurityConfiguration.class) .run((context) -> { - OAuth2AuthorizedClientService bean = context - .getBean(OAuth2AuthorizedClientService.class); - OAuth2AuthorizedClientService authorizedClientService = (OAuth2AuthorizedClientService) ReflectionTestUtils - .getField(getAuthCodeFilters(context).get(0), - "authorizedClientService"); - assertThat(authorizedClientService).isEqualTo(bean); + assertThat(context) + .hasSingleBean(OAuth2AuthorizedClientService.class); + assertThat(context).hasBean("testAuthorizedClientService"); }); }