@Test
  public void DropDatabaseCascade() throws Exception {
    String dbName = "dropDatabase";
    reset(mockedAuthorizer);
    driver.run("create database " + dbName);
    final String tableName1 = "drop_tbl1", tableName2 = "drop_tbl2", funcName = "testdropfunc";
    driver.run("create table " + dbName + "." + tableName1 + "(eid int, yoj int)");
    driver.run("create table " + dbName + "." + tableName2 + "(eid int, name string)");
    driver.run("create function " + dbName + "." + funcName + " as 'org.apache.hadoop.hive.ql.udf.UDFRand'");
    reset(mockedAuthorizer);
    int status = driver.compile("DROP DATABASE " + dbName + " CASCADE", true);
    assertEquals(0, status);
    Pair<List<HivePrivilegeObject>, List<HivePrivilegeObject>> io = getHivePrivilegeObjectInputs();
    List<HivePrivilegeObject> inputs = io.getLeft();
    assertEquals(1, inputs.size()); // database object
    List<HivePrivilegeObject> outputs = io.getRight();
    assertEquals(4, outputs.size()); //  2 tables, 1 function and 1 db
    HivePrivilegeObject privilegeObject = outputs.get(0);
    assertEquals("input type", HivePrivilegeObjectType.TABLE_OR_VIEW, privilegeObject.getType());
    privilegeObject = outputs.get(1);
    assertEquals("input type", HivePrivilegeObjectType.TABLE_OR_VIEW, privilegeObject.getType());
    privilegeObject = outputs.get(2);
    assertEquals("input type", HivePrivilegeObjectType.FUNCTION, privilegeObject.getType());
    privilegeObject = outputs.get(3);
    assertEquals("input type", HivePrivilegeObjectType.DATABASE, privilegeObject.getType());
  }
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