Update test to align with more precise information about target class

The latest Spring Framework 4.2.2 snapshots have reworked
EventListenerMethodProcessor so that it no longer queries a proxies
target class. Previously, when this was happening, it happened early
in the context's lifecycle when the bean's concrete type was unknown.
The led to the target class being set as the proxied interface.

With the latest 4.2.2 snapshots, the first call to
AopUtils.getTargetClass() happens in the test, by which time the
actual concrete type of the bean is known. This commit updates the
test so that its expectations match the more precise result.
pull/4119/head
Andy Wilkinson 9 years ago
parent 377107c4ff
commit 0cdf19a4cb

@ -76,6 +76,7 @@ import org.springframework.security.oauth2.provider.approval.ApprovalStoreUserAp
import org.springframework.security.oauth2.provider.approval.TokenApprovalStore;
import org.springframework.security.oauth2.provider.approval.UserApprovalHandler;
import org.springframework.security.oauth2.provider.client.BaseClientDetails;
import org.springframework.security.oauth2.provider.client.InMemoryClientDetailsService;
import org.springframework.security.oauth2.provider.endpoint.AuthorizationEndpoint;
import org.springframework.security.oauth2.provider.expression.OAuth2MethodSecurityExpressionHandler;
import org.springframework.security.oauth2.provider.token.DefaultTokenServices;
@ -92,6 +93,7 @@ import org.springframework.web.client.RestTemplate;
import com.fasterxml.jackson.databind.JsonNode;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
/**
@ -129,8 +131,8 @@ public class OAuth2AutoConfigurationTests {
ClientDetails clientDetails = clientDetailsService.loadClientByClientId(config
.getClientId());
assertThat(AopUtils.isJdkDynamicProxy(clientDetailsService), equalTo(true));
assertThat(AopUtils.getTargetClass(clientDetailsService).getName(),
equalTo(ClientDetailsService.class.getName()));
assertThat(AopUtils.getTargetClass(clientDetailsService),
is(equalTo(InMemoryClientDetailsService.class)));
assertThat(handler instanceof ApprovalStoreUserApprovalHandler, equalTo(true));
assertThat(clientDetails, equalTo(config));
verifyAuthentication(config);

Loading…
Cancel
Save