@Test
public void testSetEnvFromInputProperty() {

  Configuration conf = new Configuration(false);
  Map<String, String> env = new HashMap<>();
  String propName = "mapreduce.map.env";
  String defaultPropName = "mapreduce.child.env";
  // Setup environment input properties
  conf.set(propName, "env1=env1_val,env2=env2_val,env3=env3_val");
  conf.set(propName + ".env4", "env4_val");
  conf.set(propName + ".env2", "new_env2_val");
  // Setup some default values - we shouldn't see these values
  conf.set(defaultPropName, "env1=def1_val,env2=def2_val,env3=def3_val");
  String defaultPropValue = conf.get(defaultPropName);
  // These should never be referenced.
  conf.set(defaultPropName + ".env4", "def4_val");
  conf.set(defaultPropName + ".env2", "new_def2_val");
  Apps.setEnvFromInputProperty(env, propName, defaultPropValue, conf,
      File.pathSeparator);
  // Check values from string
  assertEquals("env1_val", env.get("env1"));
  assertEquals("env3_val", env.get("env3"));
  // Check individual value
  assertEquals("env4_val", env.get("env4"));
  // Check individual value that eclipses one in string
  assertEquals("new_env2_val", env.get("env2"));
}