SEC-1826: Empty attribute list should be treated the same as null in DelegatingMethodSecurityMetadataSource.

This commit is contained in:
Luke Taylor
2011-09-24 14:13:57 +01:00
parent be8ee61f82
commit 44364d0101
3 changed files with 9 additions and 12 deletions

View File

@@ -20,7 +20,7 @@ public class DelegatingMethodSecurityMetadataSourceTests {
DelegatingMethodSecurityMetadataSource mds;
@Test
public void returnsNullIfDelegateReturnsNull() throws Exception {
public void returnsEmptyListIfDelegateReturnsNull() throws Exception {
List sources = new ArrayList();
MethodSecurityMetadataSource delegate = mock(MethodSecurityMetadataSource.class);
when(delegate.getAttributes(Matchers.<Method>any(), Matchers.any(Class.class))).thenReturn(null);
@@ -29,9 +29,9 @@ public class DelegatingMethodSecurityMetadataSourceTests {
assertSame(sources, mds.getMethodSecurityMetadataSources());
assertTrue(mds.getAllConfigAttributes().isEmpty());
MethodInvocation mi = new SimpleMethodInvocation(null, String.class.getMethod("toString"));
assertNull(mds.getAttributes(mi));
assertEquals(Collections.emptyList(), mds.getAttributes(mi));
// Exercise the cached case
assertNull(mds.getAttributes(mi));
assertEquals(Collections.emptyList(), mds.getAttributes(mi));
}
@Test