diff --git a/core/src/main/java/org/springframework/security/access/intercept/aspectj/AspectJCallback.java b/core/src/main/java/org/springframework/security/access/intercept/aspectj/AspectJCallback.java index c332bfb232..6fabacdb25 100644 --- a/core/src/main/java/org/springframework/security/access/intercept/aspectj/AspectJCallback.java +++ b/core/src/main/java/org/springframework/security/access/intercept/aspectj/AspectJCallback.java @@ -16,7 +16,7 @@ package org.springframework.security.access.intercept.aspectj; /** - * Called by the {@link AspectJSecurityInterceptor} when it wishes for the + * Called by the {@link AspectJMethodSecurityInterceptor} when it wishes for the * AspectJ processing to continue. Typically implemented in the * around() advice as a simple return proceed(); * statement. diff --git a/core/src/test/java/org/springframework/security/access/intercept/aspectj/AspectJMethodSecurityInterceptorTests.java b/core/src/test/java/org/springframework/security/access/intercept/aspectj/AspectJMethodSecurityInterceptorTests.java index f8d7c9e8fe..b79b3580be 100644 --- a/core/src/test/java/org/springframework/security/access/intercept/aspectj/AspectJMethodSecurityInterceptorTests.java +++ b/core/src/test/java/org/springframework/security/access/intercept/aspectj/AspectJMethodSecurityInterceptorTests.java @@ -15,7 +15,7 @@ package org.springframework.security.access.intercept.aspectj; -import static org.junit.Assert.fail; +import static org.junit.Assert.*; import static org.mockito.Matchers.any; import static org.mockito.Mockito.*; @@ -37,6 +37,7 @@ import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.TestingAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.util.ClassUtils; import java.lang.reflect.Method; import java.util.Collection; @@ -114,4 +115,18 @@ public class AspectJMethodSecurityInterceptorTests { } verify(aspectJCallback, never()).proceedWithObject(); } + + @Test + public void adapterHoldsCorrectData() throws Exception { + TargetObject to = new TargetObject(); + Method m = ClassUtils.getMethodIfAvailable(TargetObject.class, "countLength", new Class[] {String.class}); + + when(joinPoint.getTarget()).thenReturn(to); + when(joinPoint.getArgs()).thenReturn(new Object[] {"Hi"}); + MethodInvocationAdapter mia = new MethodInvocationAdapter(joinPoint); + assertEquals("Hi", mia.getArguments()[0]); + assertEquals(m, mia.getStaticPart()); + assertEquals(m, mia.getMethod()); + assertSame(to, mia.getThis()); + } }