Merge pull request #13872 from

* pr/13872:
  Fix OAuth2WebSecurityConfigurationTests
pull/13863/merge
Stephane Nicoll 6 years ago
commit 62830ee1b8

@ -85,12 +85,8 @@ public class OAuth2WebSecurityConfigurationTests {
public void configurationRegistersAuthorizedClientServiceBean() { public void configurationRegistersAuthorizedClientServiceBean() {
this.contextRunner.withUserConfiguration(ClientRepositoryConfiguration.class, this.contextRunner.withUserConfiguration(ClientRepositoryConfiguration.class,
OAuth2WebSecurityConfiguration.class).run((context) -> { OAuth2WebSecurityConfiguration.class).run((context) -> {
OAuth2AuthorizedClientService bean = context assertThat(context)
.getBean(OAuth2AuthorizedClientService.class); .hasSingleBean(OAuth2AuthorizedClientService.class);
OAuth2AuthorizedClientService authorizedClientService = (OAuth2AuthorizedClientService) ReflectionTestUtils
.getField(getAuthCodeFilters(context).get(0),
"authorizedClientService");
assertThat(authorizedClientService).isEqualTo(bean);
}); });
} }
@ -110,12 +106,9 @@ public class OAuth2WebSecurityConfigurationTests {
.withUserConfiguration(OAuth2AuthorizedClientServiceConfiguration.class, .withUserConfiguration(OAuth2AuthorizedClientServiceConfiguration.class,
OAuth2WebSecurityConfiguration.class) OAuth2WebSecurityConfiguration.class)
.run((context) -> { .run((context) -> {
OAuth2AuthorizedClientService bean = context assertThat(context)
.getBean(OAuth2AuthorizedClientService.class); .hasSingleBean(OAuth2AuthorizedClientService.class);
OAuth2AuthorizedClientService authorizedClientService = (OAuth2AuthorizedClientService) ReflectionTestUtils assertThat(context).hasBean("testAuthorizedClientService");
.getField(getAuthCodeFilters(context).get(0),
"authorizedClientService");
assertThat(authorizedClientService).isEqualTo(bean);
}); });
} }

Loading…
Cancel
Save