@Test
  public void testTempTable() throws Exception {

    String tmpTableDir = getDefaultTmp() + File.separator + "THSAC_testTableTable";

    final String tableName = "testTempTable";
    { // create temp table
      reset(mockedAuthorizer);
      driver.run("create temporary table " + tableName + "(i int) location '" + tmpTableDir + "'");

      List<HivePrivilegeObject> inputs = getHivePrivilegeObjectInputs().getLeft();
      List<HivePrivilegeObject> outputs = getHivePrivilegeObjectInputs().getRight();

      // only the URI should be passed for authorization check
      assertEquals("input count", 1, inputs.size());
      assertEquals("input type", HivePrivilegeObjectType.LOCAL_URI, inputs.get(0).getType());

      // only the dbname should be passed authorization check
      assertEquals("output count", 1, outputs.size());
      assertEquals("output type", HivePrivilegeObjectType.DATABASE, outputs.get(0).getType());

      int status = driver.compile("select * from " + tableName, true);
      assertEquals(0, status);
    }
    { // select from the temp table
      reset(mockedAuthorizer);
      int status = driver.compile("insert into " + tableName + " values(1)", true);
      assertEquals(0, status);

      // temp tables should be skipped from authorization
      List<HivePrivilegeObject> inputs = getHivePrivilegeObjectInputs().getLeft();
      List<HivePrivilegeObject> outputs = getHivePrivilegeObjectInputs().getRight();
      System.err.println("inputs " + inputs);
      System.err.println("outputs " + outputs);

      assertEquals("input count", 0, inputs.size());
      assertEquals("output count", 0, outputs.size());
    }
    { // select from the temp table
      reset(mockedAuthorizer);
      int status = driver.compile("select * from " + tableName, true);
      assertEquals(0, status);

      // temp tables should be skipped from authorization
      List<HivePrivilegeObject> inputs = getHivePrivilegeObjectInputs().getLeft();
      List<HivePrivilegeObject> outputs = getHivePrivilegeObjectInputs().getRight();
      System.err.println("inputs " + inputs);
      System.err.println("outputs " + outputs);

      assertEquals("input count", 0, inputs.size());
      assertEquals("output count", 0, outputs.size());
    }

  }
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/hadoop/hive/ql/security/authorization/plugin/TestHiveAuthorizerCheckInvocation.java