@Test
  public void otherCatalog() throws TException {
    String catName = "functions_catalog";
    Catalog cat = new CatalogBuilder()
        .setName(catName)
        .setLocation(MetaStoreTestUtils.getTestWarehouseDir(catName))
        .build();
    client.createCatalog(cat);

    String dbName = "functions_other_catalog_db";
    Database db = new DatabaseBuilder()
        .setCatalogName(catName)
        .setName(dbName)
        .create(client, metaStore.getConf());

    String functionName = "test_function";
    Function function =
        new FunctionBuilder()
            .inDb(db)
            .setName(functionName)
            .setClass(TEST_FUNCTION_CLASS)
            .setFunctionType(FunctionType.JAVA)
            .setOwnerType(PrincipalType.ROLE)
            .setOwner("owner")
            .setCreateTime(100)
            .addResourceUri(new ResourceUri(ResourceType.JAR, "hdfs:///tmp/jar1.jar"))
            .addResourceUri(new ResourceUri(ResourceType.FILE, "hdfs:///tmp/file1.txt"))
            .addResourceUri(new ResourceUri(ResourceType.ARCHIVE, "hdfs:///tmp/archive1.tgz"))
            .create(client, metaStore.getConf());

    Function createdFunction = client.getFunction(catName, dbName, functionName);
    // The createTime will be set on the server side, so the comparison should skip it
    function.setCreateTime(createdFunction.getCreateTime());
    Assert.assertEquals("Comparing functions", function, createdFunction);

    String f2Name = "testy_function2";
    Function f2 = new FunctionBuilder()
        .inDb(db)
        .setName(f2Name)
        .setClass(TEST_FUNCTION_CLASS)
        .create(client, metaStore.getConf());

    Set<String> functions = new HashSet<>(client.getFunctions(catName, dbName, "test*"));
    Assert.assertEquals(2, functions.size());
    Assert.assertTrue(functions.contains(functionName));
    Assert.assertTrue(functions.contains(f2Name));

    functions = new HashSet<>(client.getFunctions(catName, dbName, "test_*"));
    Assert.assertEquals(1, functions.size());
    Assert.assertTrue(functions.contains(functionName));
    Assert.assertFalse(functions.contains(f2Name));

    client.dropFunction(function.getCatName(), function.getDbName(), function.getFunctionName());
    try {
      client.getFunction(function.getCatName(), function.getDbName(), function.getFunctionName());
      Assert.fail("Expected a NoSuchObjectException to be thrown");
    } catch (NoSuchObjectException exception) {
      // Expected exception
    }
  }
This test creates and queries a function and then drops it. Good for testing the happy path.
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestFunctions.java