/** * {@inheritDoc} */ @Override public String findGroupDn(String group) throws NamingException { return execute(groupBases, queries.findGroupDnById(group)).getSingleLdapName(); }
@Test(expected = NamingException.class) public void testGetSingleLdapNameNoRecords() throws NamingException { MockResultCollection resultCollection = MockResultCollection.create() .addEmptySearchResult(); handler = new SearchResultHandler(resultCollection); try { handler.getSingleLdapName(); } finally { assertAllNamingEnumerationsClosed(resultCollection); } }
@Test public void testGetSingleLdapName() throws NamingException { String objectDn = "cn=a,dc=b,dc=c"; MockResultCollection resultCollection = MockResultCollection.create() .addEmptySearchResult() .addSearchResultWithDns(objectDn); handler = new SearchResultHandler(resultCollection); String expected = objectDn; String actual = handler.getSingleLdapName(); assertEquals(expected, actual); assertAllNamingEnumerationsClosed(resultCollection); }
/** * {@inheritDoc} */ @Override public String findGroupDn(String group) throws NamingException { return execute(groupBases, queries.findGroupDnById(group)).getSingleLdapName(); }