@Test public void testValidateThrowsException() throws Exception { LdapConnection connection = Mockito.mock(LdapConnection.class); doThrow(LdapException.class).when(connection).lookup(Dn.ROOT_DSE, SchemaConstants.NO_ATTRIBUTE); assertFalse(validator.validate(connection)); }
public boolean validate(LdapConnection connection) { try { return connection.isConnected() && (connection.lookup(Dn.ROOT_DSE, SchemaConstants.NO_ATTRIBUTE) != null); } catch (LdapException e) { log.info("validating failed: {}", e); return false; } }
UnboundLookupConnectionValidator implements LdapConnectionValidator { public boolean validate(LdapConnection connection) { try { return connection.isConnected() && (connection.lookup(Dn.ROOT_DSE, SchemaConstants.NO_ATTRIBUTE) != null); } catch (LdapException e) { log.info("validating failed: {}", e); return false; } } }
UnboundLookupConnectionValidator implements LdapConnectionValidator { public boolean validate(LdapConnection connection) { try { return connection.isConnected() && (connection.lookup(Dn.ROOT_DSE, SchemaConstants.NO_ATTRIBUTE) != null); } catch (LdapException e) { log.info("validating failed: {}", e); return false; } }  }
UnboundLookupConnectionValidator implements LdapConnectionValidator { public boolean validate(LdapConnection connection) { try { return connection.isConnected() && (connection.lookup(Dn.ROOT_DSE, SchemaConstants.NO_ATTRIBUTE) != null); } catch (LdapException e) { log.info("validating failed: {}", e); return false; } }  boolean validate(LdapConnection connection); }
UnboundLookupConnectionValidator implements LdapConnectionValidator { public boolean validate(LdapConnection connection) { try { return connection.isConnected() && (connection.lookup(Dn.ROOT_DSE, SchemaConstants.NO_ATTRIBUTE) != null); } catch (LdapException e) { log.info("validating failed: {}", e); return false; } }  boolean validate(LdapConnection connection);  }