@Test
  public void testAdditionalConfigFiles() throws Exception{
    URL url = ClassLoader.getSystemResource("hive-site.xml");
    File fileHiveSite = new File(url.getPath());

    String parFolder = fileHiveSite.getParent();
    //back up hive-site.xml
    String bakHiveSiteFileName = parFolder + "/hive-site-bak.xml";
    File fileBakHiveSite = new File(bakHiveSiteFileName);
    FileUtils.copyFile(fileHiveSite, fileBakHiveSite);

    String content = FileUtils.readFileToString(fileHiveSite);
    content = content.substring(0, content.lastIndexOf("</configuration>"));

    String testHiveSiteString = content + "<property>\n" +
            " <name>HIVE_SERVER2_PLAIN_LDAP_DOMAIN</name>\n" +
            " <value>a.com</value>\n" +
            "</property>\n" +
            "\n" +
            " <property>\n" +
            "   <name>hive.additional.config.files</name>\n" +
            "   <value>ldap-site.xml,other.xml</value>\n" +
            "   <description>additional config dir for Hive to load</description>\n" +
            " </property>\n" +
            "\n" +
            "</configuration>";

    FileUtils.writeStringToFile(fileHiveSite, testHiveSiteString);

    String testLdapString = """
            <?xml version="1.0"?>
            <?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
            <configuration>
              <property>
              <name>hive.server2.authentication.ldap.Domain</name>
              <value>b.com</value>
            </property>
            
            </configuration>\
            """;


    String newFileName = parFolder+"/ldap-site.xml";
    File f2 = new File(newFileName);
    FileUtils.writeStringToFile(f2, testLdapString);

    HiveConf conf = new HiveConf();
    String val = conf.getVar(ConfVars.HIVE_SERVER2_PLAIN_LDAP_DOMAIN);
    Assert.assertEquals("b.com", val);
    //restore and clean up
    FileUtils.copyFile(fileBakHiveSite, fileHiveSite);
    f2.delete();
    fileBakHiveSite.delete();
  }
TestHiveConf

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