### Question:
ServerGroupConfiguration implements ConnectionConfig { public Set<LDAPURL> getLDAPURLs() { Collection<Server> servers = group.getServersList(); Set<LDAPURL> ret = new LinkedHashSet<LDAPURL>(servers.size()); for (Server server : servers) { ret.add(LDAPURL.valueOf(server.getServerName(), server.getPort(), Server.Type.CONN_SSL.equals(server.getConnectionType()))); } return ret; } ServerGroupConfiguration(ServerGroup group, ServerInstance instance); String getBindDN(); char[] getBindPassword(); int getMaxConnections(); int getLdapHeartbeat(); Set<LDAPURL> getLDAPURLs();  }### Answer:
@Test public void shouldReturnCorrectLDAPURLforSimpleConnections() { String hostName = "localhost"; int port = 389; Server one = mock(Server.class); given(one.getServerName()).willReturn(hostName); given(one.getPort()).willReturn(port); given(one.getConnectionType()).willReturn(Server.Type.CONN_SIMPLE); ServerInstance mockInstance = mock(ServerInstance.class); ServerGroup mockGroup = mock(ServerGroup.class); given(mockGroup.getServersList()).willReturn(Arrays.asList(one)); ServerGroupConfiguration config = new ServerGroupConfiguration(mockGroup, mockInstance); Set<LDAPURL> result = config.getLDAPURLs(); assertThat(result).hasSize(1); LDAPURL url = result.iterator().next(); assertThat(url.getHost()).isEqualTo(hostName); assertThat(url.getPort()).isEqualTo(port); assertThat(url.isSSL()).isFalse(); }
@Test public void shouldReturnCorrectLDAPURLforSSLConnections() { String hostName = "localhost"; int port = 389; Server one = mock(Server.class); given(one.getServerName()).willReturn(hostName); given(one.getPort()).willReturn(port); given(one.getConnectionType()).willReturn(Server.Type.CONN_SSL); ServerInstance mockInstance = mock(ServerInstance.class); ServerGroup mockGroup = mock(ServerGroup.class); given(mockGroup.getServersList()).willReturn(Arrays.asList(one)); ServerGroupConfiguration config = new ServerGroupConfiguration(mockGroup, mockInstance); Set<LDAPURL> result = config.getLDAPURLs(); assertThat(result).hasSize(1); LDAPURL url = result.iterator().next(); assertThat(url.getHost()).isEqualTo(hostName); assertThat(url.getPort()).isEqualTo(port); assertThat(url.isSSL()).isTrue(); }