@Test
public void testParseOverwrite() {

  DistCpOptions options = OptionsParser.parse(new String[] {
      "hdfs://localhost:8020/source/first",
      "hdfs://localhost:8020/target/"});
  Assert.assertFalse(options.shouldOverwrite());
  options = OptionsParser.parse(new String[] {
      "-overwrite",
      "hdfs://localhost:8020/source/first",
      "hdfs://localhost:8020/target/"});
  Assert.assertTrue(options.shouldOverwrite());
  try {
    OptionsParser.parse(new String[] {
        "-update",
        "-overwrite",
        "hdfs://localhost:8020/source/first",
        "hdfs://localhost:8020/target/"});
    Assert.fail("Update and overwrite aren't allowed together");
  } catch (IllegalArgumentException ignore) {
  }
}