@Test
public void testLogSystemProperties() throws Exception {

  Configuration conf = new Configuration();
  // test no logging
  conf.set(MRJobConfig.MAPREDUCE_JVM_SYSTEM_PROPERTIES_TO_LOG, " ");
  String value = MRApps.getSystemPropertiesToLog(conf);
  assertNull(value);
  // test logging of selected keys
  String classpath = "java.class.path";
  String os = "os.name";
  String version = "java.version";
  conf.set(MRJobConfig.MAPREDUCE_JVM_SYSTEM_PROPERTIES_TO_LOG, classpath + ", " + os);
  value = MRApps.getSystemPropertiesToLog(conf);
  assertNotNull(value);
  assertTrue(value.contains(classpath));
  assertTrue(value.contains(os));
  assertFalse(value.contains(version));
}