@Test public void testMultiAttributeRetrievalWithSpecifiedAttributeNames() { Set<Map<String, List<String>>> values = template.searchForMultipleAttributeValues( "ou=people", "(uid={0})", new String[] {"bob"}, new String[] {"uid", "cn", "sn"}); assertEquals(1, values.size()); Map<String, List<String>> record = values.iterator().next(); assertAttributeValue(record, "uid", "bob"); assertAttributeValue(record, "cn", "Bob Hamilton"); assertAttributeValue(record, "sn", "Hamilton"); assertFalse(record.containsKey("userPassword")); assertFalse(record.containsKey("objectclass")); }
@Test public void testMultiAttributeRetrievalWithZeroLengthAttributeNames() { Set<Map<String, List<String>>> values = template.searchForMultipleAttributeValues( "ou=people", "(uid={0})", new String[] {"bob"}, new String[0]); assertEquals(1, values.size()); Map<String, List<String>> record = values.iterator().next(); assertAttributeValue(record, "uid", "bob"); assertAttributeValue( record, "objectclass", "top", "person", "organizationalPerson", "inetOrgPerson"); assertAttributeValue(record, "cn", "Bob Hamilton"); assertAttributeValue(record, "sn", "Hamilton"); assertFalse(record.containsKey("userPassword")); }