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());
      }
    }
  }
@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"));
  }