@Test
  public void testAlterFunctionCaseInsensitive() throws Exception {
    Function newFunction =
        new FunctionBuilder()
            .setDbName(OTHER_DATABASE)
            .setName("test_function_2")
            .setClass(TEST_FUNCTION_CLASS)
            .build(metaStore.getConf());
    Function originalFunction = testFunctions[1];

    // Test in upper case
    client.alterFunction(originalFunction.getDbName().toUpperCase(),
        originalFunction.getFunctionName().toUpperCase(), newFunction);
    Function alteredFunction = client.getFunction(newFunction.getDbName(),
        newFunction.getFunctionName());

    // The creation time is changed, so we do not check that
    newFunction.setCreateTime(alteredFunction.getCreateTime());
    Assert.assertEquals("Comparing functions", newFunction, alteredFunction);
    try {
      client.getFunction(originalFunction.getDbName(), originalFunction.getDbName());
      Assert.fail("Expected a NoSuchObjectException to be thrown");
    } catch (NoSuchObjectException exception) {
      // Expected exception
    }

    // Test in mixed case
    originalFunction = testFunctions[2];
    newFunction.setFunctionName("test_function_3");
    client.alterFunction("DeFaUlt", "tEsT_FuncTION_HiDDEn_1", newFunction);
    alteredFunction = client.getFunction(newFunction.getDbName(), newFunction.getFunctionName());

    // The creation time is changed, so we do not check that
    newFunction.setCreateTime(alteredFunction.getCreateTime());
    Assert.assertEquals("Comparing functions", newFunction, alteredFunction);
    try {
      client.getFunction(originalFunction.getDbName(), originalFunction.getDbName());
      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