@Override
  public String[] getGroupsForUser(String user) throws IOException {
    // parameter verification.
    if (StringUtils.isBlank(user)) {
      routerMetrics.incrGetGroupsForUserFailedRetrieved();
      RouterServerUtil.logAndThrowIOException("Missing getGroupsForUser user.", null);
    }

    try {
      long startTime = clock.getTime();
      RMAdminProtocolMethod remoteMethod = new RMAdminProtocolMethod(
          new Class[]{String.class}, new Object[]{user});
      Collection<String[]> getGroupsForUserResps =
          remoteMethod.invokeConcurrent(this, String[].class, null);
      if (CollectionUtils.isNotEmpty(getGroupsForUserResps)) {
        long stopTime = clock.getTime();
        Set<String> groups = new HashSet<>();
        for (String[] groupArr : getGroupsForUserResps) {
          if (groupArr != null && groupArr.length > 0) {
            for (String group : groupArr) {
              groups.add(group);
            }
          }
        }
        routerMetrics.succeededGetGroupsForUsersRetrieved(stopTime - startTime);
        return groups.toArray(new String[]{});
      }
    } catch (YarnException e) {
      routerMetrics.incrGetGroupsForUserFailedRetrieved();
      RouterServerUtil.logAndThrowIOException(e,
          "Unable to getGroupsForUser due to exception. " + e.getMessage());
    }

    routerMetrics.incrGetGroupsForUserFailedRetrieved();
    throw new IOException("Unable to getGroupsForUser.");
  }
@Test
  public void testGetGroupsForUserRequest() throws Exception {
    // null request1.
    LambdaTestUtils.intercept(IOException.class, "Missing getGroupsForUser user.",
        () -> interceptor.getGroupsForUser(null));
  }