@Test
  public void testGetFunctions() throws Exception {
    // Find functions which name contains _to_find_ in the default database
    List<String> functions = client.getFunctions(DEFAULT_DATABASE, "*_to_find_*");
    Assert.assertEquals("Found functions size", 2, functions.size());
    Assert.assertTrue("Should contain", functions.contains("test_function_to_find_1"));
    Assert.assertTrue("Should contain", functions.contains("test_function_to_find_2"));

    // Find functions which name contains _to_find_ or _hidden_ in the default database
    functions = client.getFunctions(DEFAULT_DATABASE, "*_to_find_*|*_hidden_*");
    Assert.assertEquals("Found functions size", 3, functions.size());
    Assert.assertTrue("Should contain", functions.contains("test_function_to_find_1"));
    Assert.assertTrue("Should contain", functions.contains("test_function_to_find_2"));
    Assert.assertTrue("Should contain", functions.contains("test_function_hidden_1"));

    // Find functions which name contains _to_find_ in the dummy database
    functions = client.getFunctions(OTHER_DATABASE, "*_to_find_*");
    Assert.assertEquals("Found functions size", 1, functions.size());
    Assert.assertTrue("Should contain", functions.contains("test_function_to_find_1"));

    // Look for functions but do not find any
    functions = client.getFunctions(DEFAULT_DATABASE, "*_not_such_function_*");
    Assert.assertEquals("No such functions size", 0, functions.size());

    // Look for functions without pattern
    functions = client.getFunctions(DEFAULT_DATABASE, null);
    Assert.assertEquals("Search functions without pattern size", 3, functions.size());

    // Look for functions with empty pattern
    functions = client.getFunctions(DEFAULT_DATABASE, "");
    Assert.assertEquals("Search functions with empty pattern", 0, functions.size());

    // No such database
    functions = client.getFunctions("no_such_database", "*_to_find_*");
    Assert.assertEquals("No such functions size", 0, functions.size());
  }
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