@Override
  public List<SQLForeignKey> addForeignKeys(List<SQLForeignKey> fks) throws InvalidObjectException,
          MetaException {
    if (callerVerifier != null) {
      CallerArguments args = new CallerArguments(fks.get(0).getFktable_db());
      args.constraintTblName = fks.get(0).getFktable_name();
      Boolean success = callerVerifier.apply(args);
      if ((success != null) && !success) {
        throw new MetaException("InjectableBehaviourObjectStore: Invalid Add Foreign Key operation on DB: "
                + args.dbName + " table: " + args.constraintTblName);
      }
    }
    return super.addForeignKeys(fks);
  }
A utility class to pass the arguments of the caller to the stub method.
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/InjectableBehaviourObjectStore.java