@Test public void testEquals() throws Exception { LdapServerProperties properties1 = configuration.getLdapServerProperties(); LdapServerProperties properties2 = configuration.getLdapServerProperties(); assertTrue("Properties object is same", properties1 != properties2); assertTrue("Objects are not equal", properties1.equals(properties2)); assertTrue("Hash codes are not equal", properties1.hashCode() == properties2.hashCode()); properties2.setSecondaryUrl("5.6.7.8:389"); assertFalse("Objects are equal", properties1.equals(properties2)); }
@Test public void testGetLdapUrls() throws Exception { List<String> urls = ldapServerProperties.getLdapUrls(); assertEquals(INCORRECT_URL_LIST, 1, urls.size()); assertEquals(INCORRECT_URL_LIST, "ldap://1.2.3.4:389", urls.get(0)); ldapServerProperties.setSecondaryUrl("4.3.2.1:1234"); urls = ldapServerProperties.getLdapUrls(); assertEquals(INCORRECT_URL_LIST, 2, urls.size()); assertEquals(INCORRECT_URL_LIST, "ldap://4.3.2.1:1234", urls.get(1)); ldapServerProperties.setUseSsl(true); urls = ldapServerProperties.getLdapUrls(); assertEquals(INCORRECT_URL_LIST, "ldaps://1.2.3.4:389", urls.get(0)); assertEquals(INCORRECT_URL_LIST, "ldaps://4.3.2.1:1234", urls.get(1)); }