@Override
    public HiveAuthorizer createHiveAuthorizer(HiveMetastoreClientFactory metastoreClientFactory,
        HiveConf conf, HiveAuthenticationProvider authenticator, HiveAuthzSessionContext ctx) {
      TestHS2AuthzContext.mockedAuthorizer = Mockito.mock(HiveAuthorizer.class);
      TestHS2AuthzContext.authenticator = authenticator;
      return TestHS2AuthzContext.mockedAuthorizer;
    }
This factory creates a mocked HiveAuthorizer class.
Use the mocked class to capture the argument passed to it in the test case.
itests/hive-unit/src/test/java/org/apache/hive/jdbc/authorization/TestHS2AuthzContext.java