@Test
  public void testHiddenConfig() throws Exception {
    HiveConf conf = new HiveConf();

    // check that a change to the hidden list should fail
    try {
      final String name = HiveConf.ConfVars.HIVE_CONF_HIDDEN_LIST.varname;
      conf.verifyAndSet(name, "");
      conf.verifyAndSet(name + "postfix", "");
      Assert.fail("Setting config property " + name + " should fail");
    } catch (IllegalArgumentException e) {
      // the verifyAndSet in this case is expected to fail with the IllegalArgumentException
    }

    ArrayList<String> hiddenList = Lists.newArrayList(
        HiveConf.ConfVars.METASTORE_PWD.varname,
        HiveConf.ConfVars.HIVE_SERVER2_SSL_KEYSTORE_PASSWORD.varname,
        HiveConf.ConfVars.HIVE_SERVER2_WEBUI_SSL_KEYSTORE_PASSWORD.varname,
        "fs.s3.awsSecretAccessKey",
        "fs.s3n.awsSecretAccessKey",
        "dfs.adls.oauth2.credential",
        "fs.adl.oauth2.credential",
        "fs.azure.account.oauth2.client.secret"
    );

    for (String hiddenConfig : hiddenList) {
      // check configs are hidden
      Assert.assertTrue("config " + hiddenConfig + " should be hidden",
          conf.isHiddenConfig(hiddenConfig));
      // check stripHiddenConfigurations removes the property
      Configuration conf2 = new Configuration(conf);
      conf2.set(hiddenConfig, "password");
      conf.stripHiddenConfigurations(conf2);
      // check that a property that begins the same is also hidden
      Assert.assertTrue(conf.isHiddenConfig(
          hiddenConfig + "postfix"));
      // Check the stripped property is the empty string
      Assert.assertEquals("", conf2.get(hiddenConfig));
    }
  }
TestHiveConf

Test cases for HiveConf. Loads configuration files located
in common/src/test/resources.
common/src/test/org/apache/hadoop/hive/conf/TestHiveConf.java