### Question:
LdapConfigValidator { public void validateLdapConnection(LdapConfig ldapConfig) { if (ldapConfig != null) { validateLdapConnection(ldapConfig.getProtocol(), ldapConfig.getServerHost(), ldapConfig.getServerPort(), ldapConfig.getBindDn(), ldapConfig.getBindPassword()); } }  void validateLdapConnection(LdapConfig ldapConfig);  }### Answer:
@Test public void testInvalidLdapConnection() { LdapConfig ldapConfig = ldapConfig(); ldapConfig.setProtocol("ldap: BadRequestException ex = Assertions.assertThrows(BadRequestException.class, () -> { underTest.validateLdapConnection(ldapConfig); }); assertEquals("Failed to connect to LDAP server: Invalid name: /localhost:389", ex.getMessage()); }