ConfigurationUtils { public static void injectDefaults(Configuration source, Configuration target) { Check.notNull(source, "source"); Check.notNull(target, "target"); for (Map.Entry<String, String> entry : source) { if (target.get(entry.getKey()) == null) { target.set(entry.getKey(), entry.getValue()); } } }  static void copy(Configuration source, Configuration target); static void injectDefaults(Configuration source,
      Configuration target); static Configuration resolve(Configuration conf); static void load(Configuration conf, InputStream is);  }
@Test public void injectDefaults() throws Exception { Configuration srcConf = new Configuration(false); Configuration targetConf = new Configuration(false); srcConf.set("testParameter1", "valueFromSource"); srcConf.set("testParameter2", "valueFromSource"); targetConf.set("testParameter2", "originalValueFromTarget"); targetConf.set("testParameter3", "originalValueFromTarget"); ConfigurationUtils.injectDefaults(srcConf, targetConf); assertEquals("valueFromSource", targetConf.get("testParameter1")); assertEquals("originalValueFromTarget", targetConf.get("testParameter2")); assertEquals("originalValueFromTarget", targetConf.get("testParameter3")); assertEquals("valueFromSource", srcConf.get("testParameter1")); assertEquals("valueFromSource", srcConf.get("testParameter2")); assertNull(srcConf.get("testParameter3")); }