@Override
    public HiveAuthorizer createHiveAuthorizer(HiveMetastoreClientFactory metastoreClientFactory,
        HiveConf conf, HiveAuthenticationProvider authenticator, HiveAuthzSessionContext ctx) {
      TestCLIAuthzSessionContext.sessionCtx = ctx;
      HiveAuthorizer mockedAuthorizer = Mockito.mock(HiveAuthorizer.class);
      return mockedAuthorizer;
    }
This factory captures the HiveAuthzSessionContext argument and returns mocked
HiveAuthorizer class
itests/hive-unit/src/test/java/org/apache/hive/jdbc/authorization/TestCLIAuthzSessionContext.java