@Test
public void testOptionsAppendToConf() {

  Configuration conf = new Configuration();
  Assert.assertFalse(conf.getBoolean(DistCpOptionSwitch.IGNORE_FAILURES.getConfigLabel(), false));
  Assert.assertFalse(conf.getBoolean(DistCpOptionSwitch.ATOMIC_COMMIT.getConfigLabel(), false));
  DistCpOptions options = OptionsParser.parse(new String[] {
      "-atomic",
      "-i",
      "hdfs://localhost:8020/source/first",
      "hdfs://localhost:8020/target/"});
  options.appendToConf(conf);
  Assert.assertTrue(conf.getBoolean(DistCpOptionSwitch.IGNORE_FAILURES.getConfigLabel(), false));
  Assert.assertTrue(conf.getBoolean(DistCpOptionSwitch.ATOMIC_COMMIT.getConfigLabel(), false));
  Assert.assertEquals(conf.getInt(DistCpOptionSwitch.BANDWIDTH.getConfigLabel(), -1),
      DistCpConstants.DEFAULT_BANDWIDTH_MB);
  conf = new Configuration();
  Assert.assertFalse(conf.getBoolean(DistCpOptionSwitch.SYNC_FOLDERS.getConfigLabel(), false));
  Assert.assertFalse(conf.getBoolean(DistCpOptionSwitch.DELETE_MISSING.getConfigLabel(), false));
  Assert.assertEquals(conf.get(DistCpOptionSwitch.PRESERVE_STATUS.getConfigLabel()), null);
  options = OptionsParser.parse(new String[] {
      "-update",
      "-delete",
      "-pu",
      "-bandwidth",
      "11",
      "hdfs://localhost:8020/source/first",
      "hdfs://localhost:8020/target/"});
  options.appendToConf(conf);
  Assert.assertTrue(conf.getBoolean(DistCpOptionSwitch.SYNC_FOLDERS.getConfigLabel(), false));
  Assert.assertTrue(conf.getBoolean(DistCpOptionSwitch.DELETE_MISSING.getConfigLabel(), false));
  Assert.assertEquals(conf.get(DistCpOptionSwitch.PRESERVE_STATUS.getConfigLabel()), "U");
  Assert.assertEquals(conf.getInt(DistCpOptionSwitch.BANDWIDTH.getConfigLabel(), -1), 11);
}