@Test
  public void testSessionConstructorUser() throws Exception {
    final String USER_NAME = "authtestuser";
    SessionState ss = new SessionState(getAuthV2HiveConf(), USER_NAME);
    setupDataNucleusFreeHive(ss.getConf());
    SessionState.start(ss);
    ss.getAuthenticator();

    Assert.assertEquals("check username", USER_NAME,
        HiveAuthorizerStoringUserNameFactory.username);
  }
Test if the authorization factory gets the username set in the SessionState constructor
@throws Exception
ql/src/test/org/apache/hadoop/hive/ql/parse/authorization/TestSessionUserName.java