@Test
  public void testOwnerNames() throws Exception {
    reset(mockedAuthorizer);
    driver.compile("create table default.t1 (name string)", true);

    Pair<List<HivePrivilegeObject>, List<HivePrivilegeObject>> io = getHivePrivilegeObjectInputs();
    boolean containsDBOwnerName = false;
    boolean containsTblOwnerName = false;
    for (HivePrivilegeObject hpo : io.getLeft()) {
      if (hpo.getType() == HivePrivilegeObject.HivePrivilegeObjectType.DATABASE && hpo.getOwnerName() != null) {
        containsDBOwnerName = true;
      }
      if (hpo.getType() == HivePrivilegeObject.HivePrivilegeObjectType.TABLE_OR_VIEW && hpo.getOwnerName() != null) {
        containsTblOwnerName = true;
      }
    }
    for (HivePrivilegeObject hpo : io.getRight()) {
      if (hpo.getType() == HivePrivilegeObject.HivePrivilegeObjectType.DATABASE && hpo.getOwnerName() != null) {
        containsDBOwnerName = true;
      }
      if (hpo.getType() == HivePrivilegeObject.HivePrivilegeObjectType.TABLE_OR_VIEW && hpo.getOwnerName() != null) {
        containsTblOwnerName = true;
      }
    }
    if (!containsTblOwnerName || !containsDBOwnerName) {
      String errorMessage = "Ownername is not present in HivePrivilegeObject";
      throw new HiveAuthzPluginException(errorMessage);
    }
  }
This factory creates a mocked HiveAuthorizer class. Use the mocked class to
capture the argument passed to it in the test case.
ql/src/test/org/apache/hadoop/hive/ql/security/authorization/plugin/TestHivePrivilegeObjectOwnerNameAndType.java