Polishing.

This commit is contained in:
Luke Taylor 2010-08-30 19:03:47 +01:00
parent 7a3892556c
commit 577ec27507
2 changed files with 17 additions and 2 deletions

View File

@ -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
* <code>around()</code> advice as a simple <code>return proceed();</code>
* statement.

View File

@ -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());
}
}