### Question:
LdapManager { public static String joinFilter( char operator, List<String> parts ) { final StringBuilder result = new StringBuilder(); result.append('(').append(operator); for ( final String part : parts ) { result.append('(').append(part).append(')'); } result.append(')'); return result.toString(); } LdapManager(Map<String, String> properties); static void setInstance(LdapManager instance); static LdapManager getInstance(); static List<String> splitFilter( final String input ); static String joinFilter( char operator, List<String> parts ); LdapName parseAsLdapNameOrLog( String value ); static Rdn[] getRelativeDNFromResult( SearchResult answer ); LdapContext getContext(); LdapContext getContext(LdapName baseDN); boolean checkAuthentication(Rdn[] userRDN, String password); boolean isFindUsersFromGroupsEnabled(); static LdapName createNewAbsolute( LdapName base, Rdn[] relative ); Rdn[] findUserRDN( String username ); Rdn[] findUserRDN(String username, LdapName baseDN); Rdn[] findGroupRDN(String groupname); LdapName findGroupAbsoluteDN(String groupname); Rdn[] findGroupRDN(String groupname, LdapName baseDN); boolean isGroupDN(LdapName dn); Collection<String> getHosts(); void setHosts(Collection<String> hosts); int getPort(); void setPort(int port); boolean isDebugEnabled(); void setDebugEnabled(boolean debugEnabled); boolean isSslEnabled(); void setSslEnabled(boolean sslEnabled); boolean isStartTlsEnabled(); void setStartTlsEnabled(boolean startTlsEnabled); String getUsernameField(); String getUsernameSuffix(); void setUsernameField(String usernameField); void setUsernameSuffix(String usernameSuffix); LdapUserTester.PropertyMapping getNameField(); void setNameField(LdapUserTester.PropertyMapping nameField); String getEmailField(); void setEmailField(String emailField); LdapName getBaseDN(); void setBaseDN(LdapName baseDN); LdapName getAlternateBaseDN(); void setAlternateBaseDN(LdapName alternateBaseDN); LdapName getUsersBaseDN( String username ); LdapName getGroupsBaseDN(String groupname); String getAdminDN(); void setAdminDN(String adminDN); String getAdminPassword(); void setAdminPassword(String adminPassword); void setConnectionPoolEnabled(boolean connectionPoolEnabled); boolean isConnectionPoolEnabled(); String getSearchFilter(); void setSearchFilter(String searchFilter); boolean isSubTreeSearch(); void setSubTreeSearch(boolean subTreeSearch); boolean isFollowReferralsEnabled(); void setFollowReferralsEnabled(boolean followReferrals); boolean isFollowAliasReferralsEnabled(); void setFollowAliasReferralsEnabled(boolean followAliasReferrals); String getGroupNameField(); void setGroupNameField(String groupNameField); String getGroupMemberField(); void setGroupMemberField(String groupMemberField); String getGroupDescriptionField(); void setGroupDescriptionField(String groupDescriptionField); boolean isPosixMode(); void setPosixMode(boolean posixMode); String getGroupSearchFilter(); boolean isFlattenNestedGroups(); void setFlattenNestedGroups(boolean flattenNestedGroups); void setGroupSearchFilter(String groupSearchFilter); List<String> retrieveList(String attribute, String searchFilter, int startIndex, int numResults, String suffixToTrim); List<String> retrieveList(String attribute, String searchFilter, int startIndex, int numResults, String suffixToTrim, boolean escapeJIDs); String retrieveSingle(String attribute, String searchFilter, boolean failOnMultipleResults); String retrieveSingle(String attribute, String searchFilter, boolean failOnMultipleResults, LdapName baseDN); List<String> retrieveAttributeOf(String attributeName, LdapName dn); Integer retrieveListCount(String attribute, String searchFilter); static String sanitizeSearchFilter(final String value); static LdapName escapeForJNDI(Rdn... rdn); static String sanitizeSearchFilter(final String value, boolean acceptWildcard ); static final SystemProperty<Integer> LDAP_PAGE_SIZE; }### Answer:
@Test public void testJoinFilter() throws Exception { final List<String> input = new ArrayList<>(); input.add( "foo" ); input.add( "bar" ); final String result = LdapManager.joinFilter( '|', input ); assertNotNull( result ); assertEquals( "(|(foo)(bar))", result ); }