### Question:
LdapConfigurationStoreBuilder { public LdapConfigurationStoreBuilder addDsn(final String distinguishedName, final String... tags) { checkStringArgument("distinguishedName", distinguishedName); ldapConfigurationStore = new LdapConfigurationStore(ldapConfigurationStore, readAttributesFromLdap(distinguishedName), tags); return this; } private  LdapConfigurationStoreBuilder(final DirContext dirContext); static LdapConfigurationStoreBuilder usingDirContext(final DirContext dirContext); LdapConfigurationStoreBuilder addDsnWithKey(final String key,
                                                       final String distinguishedName,
                                                       String... tags); LdapConfigurationStoreBuilder addDsn(final String distinguishedName, final String... tags); LdapConfigurationStoreBuilder addUsingSearch(final String searchBase,
                                                        final String filter,
                                                        final String keyAttribute,
                                                        final String... tags); LdapConfigurationStore done(); static final String NULL_ARGUMENT; }### Answer:
@Test(expected = ConstrettoException.class) public void testNamingException() throws Exception { when(dirContext.getAttributes(any(Name.class))).thenThrow(new NamingException("test")); try { ldapConfigurationStoreBuilder.addDsn("cn=me,dc=here,dc=com"); } finally { verify(dirContext).getAttributes(any(Name.class)); } }
@Test(expected = IllegalArgumentException.class) public void testAddDsnIllegalName() throws Exception { ldapConfigurationStoreBuilder.addDsn("This must surely be an illegal DSN"); }
@Test(expected = IllegalArgumentException.class) public void testAddDsnNull() throws Exception { ldapConfigurationStoreBuilder.addDsn(null); }
@Test(expected = IllegalArgumentException.class) public void testAddKeyAndDsnNull() throws Exception { ldapConfigurationStoreBuilder.addDsn(null, null); }