### Question:
LdapServiceImpl implements LdapService { @SuppressWarnings("unchecked") @Override public Collection<Group> getUserGroups(String realm, String uid) { DistinguishedName dn = new DistinguishedName("ou=" + realm); AndFilter filter = new AndFilter(); filter.and(new EqualsFilter(OBJECTCLASS, groupObjectClass)).and(new EqualsFilter(groupSearchAttribute, uid)); List<Group> groups = ldapTemplate.search(dn, filter.toString(), new GroupContextMapper()); return groups; }  @SuppressWarnings("rawtypes") @Override User getUser(String realm, String uid); @SuppressWarnings("unchecked") @Override Collection<Group> getUserGroups(String realm, String uid); @Override void removeUser(String realm, String uid); @Override String createUser(String realm, User user); @Override boolean updateUser(String realm, User user); @Override Collection<User> findUsersByGroups(String realm, final Collection<String> allowedGroupNames,
                                              final Collection<String> disallowedGroupNames, String tenant, Collection<String> edorgs); @Override Collection<User> findUsersByGroups(String realm, Collection<String> groupNames); @Override Collection<User> findUsersByGroups(String realm, Collection<String> groupNames, String tenant); @Override Collection<User> findUsersByAttributes(String realm, Collection<String> attributes); @Override Group getGroup(String realm, String groupName); @Override Collection<User> findUsersByGroups(String realm, Collection<String> groupNames, String tenant,
                                              Collection<String> edorgs); @Override boolean addUserToGroup(String realm, Group group, User user); @Override boolean removeUserFromGroup(String realm, Group group, User user); @Override boolean updateGroup(String realm, Group group); @Override void setLdapTemplate(LdapTemplate ldapTemplate); static final String OBJECTCLASS; }### Answer:
@Test public void testGetUserGroups() { Collection<Group> groups = ldapService.getUserGroups("LocalNew", "slcoperator"); assertNotNull(groups); Collection<String> groupNames = new ArrayList<String>(); for (Group group : groups) { groupNames.add(group.getGroupName()); } assertTrue(groupNames.contains("SLC Operator")); }