ConfigUtils { public static Config mergeLoadedConfiguration(Config config) { if (getApplicationConfig(config).hasPath(Runner.CONFIG_LOADER_PROPERTY)) { Config configLoaderConfig = getApplicationConfig(config).getConfig(Runner.CONFIG_LOADER_PROPERTY); ConfigLoader configLoader = ComponentFactory.create(ConfigLoader.class, configLoaderConfig, true); Config loadedConfig = configLoader.getConfig(); return loadedConfig.withFallback(config).resolve(); } else { return config; } }  static Config configFromPath(String path); static Config configFromResource(String resource); static Config applySubstitutions(Config config); static Config applySubstitutions(Config config, String substitutionsString); static Config getApplicationConfig(Config config); static Config mergeLoadedConfiguration(Config config); static Config findReplaceStringValues(Config config, String findRegex, Object replace); static boolean canBeCoerced(Config config, String path, ConfigValueType type); static T getOrElse(Config config, String path, T orElse); static T getOrNull(Config config, String path); static final String JAR_FILE_EXCEPTION_MESSAGE; }
@Test public void testMergeLoadedConfiguration() { Config baseConfig = ConfigUtils.configFromResource("/configuration/config-utils/base.conf"); Config mergedConfig = ConfigUtils.mergeLoadedConfiguration(baseConfig); Config expectedConfig = ConfigUtils.configFromResource("/configuration/config-utils/merged.conf"); assertEquals(expectedConfig, mergedConfig); }