### Question:
SystemPropertiesLoader { public void load() { if (withCommon) { load(new FileWithSections(SystemProperties.CONF_FILE_COMMON)); } files.forEach(this::load); if (withAtLeastOneOf) { try { loadMutuallyAlternativeFilesInEntryOrder(mutuallyAlternativeFiles); } catch (FileNotFoundException e) { log.error("Configuration loading failed", e); } } if (withAddOn) { try { Path addOnDir = Paths.get(SystemProperties.CONF_FILE_ADDON_PATH); loadFilesInOrder(addOnDir, ADDON_GLOB, LOADING_ORDER_COMPARATOR); } catch (IOException e) { log.error("Cannot load addon configuration", e); } } if (withOverrides) { try { Path overrideDir = Paths.get(SystemProperties.getConfPath(), "conf.d"); loadFilesInOrder(overrideDir, OVERRIDE_GLOB, LOADING_ORDER_COMPARATOR); } catch (IOException e) { log.error("Cannot load override configuration", e); } } if (withLocal) { load(new FileWithSections(SystemProperties.CONF_FILE_USER_LOCAL)); } optionalLocalFiles.forEach(f -> { if (Files.isReadable(Paths.get(f.getName()))) { load(f); } }); log.debug("Loaded properties:\n{}", loadedProperties); } protected  SystemPropertiesLoader(String prefix); static SystemPropertiesLoader create(); static SystemPropertiesLoader create(String prefix); SystemPropertiesLoader withCommon(); SystemPropertiesLoader withoutOverrides(); SystemPropertiesLoader withLocal(); SystemPropertiesLoader withAddOn(); SystemPropertiesLoader withCommonAndLocal(); SystemPropertiesLoader with(String fileName,
            String... sectionNames); SystemPropertiesLoader withLocalOptional(String fileName,
            String... sectionNames); SystemPropertiesLoader withAtLeastOneOf(String... filePaths); void load();  }### Answer:
@Test public void loadPropertiesOneFileOneSection() { Map<String, String> p = load(f("src/test/resources/system-properties-1.ini"), "section1"); assertEquals("value1", p.get("section1.foo-key1")); assertEquals("value2", p.get("section1.foo-key2")); assertEquals("value3", p.get("section1.foo-key3")); assertEquals("value1", p.get("section1.foo-bar-key1")); assertNull(p.get("section1.foo-key4")); }
@Test public void loadPropertiesOneFileMultipleSections() { Map<String, String> p = load(f("src/test/resources/system-properties-1.ini"), "section1", "section2"); assertEquals("value4", p.get("section2.foo-key1")); assertEquals("value5", p.get("section2.foo-key2")); assertEquals("value3", p.get("section1.foo-key3")); }
@Test public void loadPropertiesMultipleFilesOneSection() { Map<String, String> p = load(f("src/test/resources/system-properties-1.ini", "src/test/resources/system-properties-2.ini"), "section1"); assertEquals("valueX", p.get("section1.foo-key1")); assertEquals("valueY", p.get("section1.foo-key2")); assertEquals("value3", p.get("section1.foo-key3")); }
@Test public void loadPropertiesMultipleFilesMultipleSections() { Map<String, String> p = load(f("src/test/resources/system-properties-1.ini", "src/test/resources/system-properties-2.ini"), "section1", "section2", "jvm"); assertEquals("valueFoo", p.get("section2.foo-key1")); assertEquals("valueY", p.get("section1.foo-key2")); assertEquals("value3", p.get("section1.foo-key3")); assertEquals("valueX", p.get("section2.foo-keyX")); assertEquals("foo=bar", p.get("jvm.arg-0")); assertEquals("baz=xyz", p.get("jvm.arg-1")); }