SEC-1177: MethodInvocationUtils Returns Null With Valid Method String and Class. Added very simple checking of declared methods on class.
This commit is contained in:
@@ -4,6 +4,7 @@ import static org.junit.Assert.*;
|
||||
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
import org.junit.Test;
|
||||
import org.springframework.security.access.annotation.BusinessServiceImpl;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -19,13 +20,18 @@ public class MethodInvocationUtilsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createFromClassWithNoArgInfoReturnsNullForMethodWithArgs() {
|
||||
MethodInvocation mi = MethodInvocationUtils.createFromClass(String.class, "codePointAt");
|
||||
assertNull(mi);
|
||||
public void createFromClassReturnsMethodIfArgInfoOmittedAndMethodNameIsUnique() {
|
||||
MethodInvocation mi = MethodInvocationUtils.createFromClass(BusinessServiceImpl.class, "methodReturningAnArray");
|
||||
assertNotNull(mi);
|
||||
}
|
||||
|
||||
@Test(expected=IllegalArgumentException.class)
|
||||
public void exceptionIsRaisedIfArgInfoOmittedAndMethodNameIsNotUnique() {
|
||||
MethodInvocationUtils.createFromClass(BusinessServiceImpl.class, "methodReturningAList");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createFromClassReturnsMethodIfGivArgInfoForMethodWithArgs() {
|
||||
public void createFromClassReturnsMethodIfGivenArgInfoForMethodWithArgs() {
|
||||
MethodInvocation mi = MethodInvocationUtils.createFromClass(null, String.class, "compareTo",
|
||||
new Class<?>[]{String.class}, new Object[] {""});
|
||||
assertNotNull(mi);
|
||||
|
||||
Reference in New Issue
Block a user