mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-06-29 15:22:15 +00:00
SEC-449: Reamed template test class to match tested class. Added test method for case when no attribute value is found.
This commit is contained in:
parent
223a597208
commit
fdbcbec9d8
@ -28,7 +28,7 @@ import javax.naming.directory.DirContext;
|
|||||||
* @author Luke Taylor
|
* @author Luke Taylor
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class LdapTemplateTests extends AbstractLdapIntegrationTests {
|
public class SpringSecurityLdapTemplateTests extends AbstractLdapIntegrationTests {
|
||||||
//~ Instance fields ================================================================================================
|
//~ Instance fields ================================================================================================
|
||||||
|
|
||||||
private SpringSecurityLdapTemplate template;
|
private SpringSecurityLdapTemplate template;
|
||||||
@ -75,7 +75,7 @@ public class LdapTemplateTests extends AbstractLdapIntegrationTests {
|
|||||||
} catch (UncategorizedLdapException expected) {}
|
} catch (UncategorizedLdapException expected) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSearchForSingleAttributeValues() {
|
public void testRoleSearchReturnsCorrectNumberOfRoles() {
|
||||||
String param = "uid=ben,ou=people,dc=acegisecurity,dc=org";
|
String param = "uid=ben,ou=people,dc=acegisecurity,dc=org";
|
||||||
|
|
||||||
Set values = template.searchForSingleAttributeValues("ou=groups", "(member={0})", new String[] {param}, "ou");
|
Set values = template.searchForSingleAttributeValues("ou=groups", "(member={0})", new String[] {param}, "ou");
|
||||||
@ -85,4 +85,12 @@ public class LdapTemplateTests extends AbstractLdapIntegrationTests {
|
|||||||
assertTrue(values.contains("manager"));
|
assertTrue(values.contains("manager"));
|
||||||
assertTrue(values.contains("submanager"));
|
assertTrue(values.contains("submanager"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testRoleSearchForMissingAttributeFailsGracefully() {
|
||||||
|
String param = "uid=ben,ou=people,dc=acegisecurity,dc=org";
|
||||||
|
|
||||||
|
Set values = template.searchForSingleAttributeValues("ou=groups", "(member={0})", new String[] {param}, "mail");
|
||||||
|
|
||||||
|
assertEquals(0, values.size());
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user