private void setupShellMocks(String username, List<String> groups) throws IOException {
   PowerMockito.mockStatic(CommonUtils.class);
   PowerMockito.when(CommonUtils.getUnixGroups(Mockito.eq(username))).thenReturn(groups);
 }
 /**
  * Returns list of groups for a user.
  *
  * @param user get groups for this user
  * @return list of groups for a given user
  * @throws IOException when getting the UNIX groups
  */
 @Override
 public List<String> getGroups(String user) throws IOException {
   List<String> groups = CommonUtils.getUnixGroups(user);
   // remove duplicated primary group
   return new ArrayList<String>(new LinkedHashSet<String>(groups));
 }