@Test
  public void testSessionGetGroupNames() throws Exception {
    final String testUser = "authtestuser";
    final List<String> testGroups = Arrays.asList("group1", "group2");
    UserGroupInformation.createUserForTesting(testUser, testGroups.toArray(new String[0]));

    SessionState ss = new SessionState(getAuthV2HiveConf(), testUser);
    setupDataNucleusFreeHive(ss.getConf());
    assertEquals("check groups", testGroups, ss.getAuthenticator().getGroupNames());
  }
Test that the groupNames are retrieved properly from UGI
@throws Exception
ql/src/test/org/apache/hadoop/hive/ql/parse/authorization/TestSessionUserName.java