@Test
public void testParseWorkPath() {

  DistCpOptions options = OptionsParser.parse(new String[] {
      "hdfs://localhost:8020/source/first",
      "hdfs://localhost:8020/target/"});
  Assert.assertNull(options.getAtomicWorkPath());
  options = OptionsParser.parse(new String[] {
      "-atomic",
      "hdfs://localhost:8020/source/first",
      "hdfs://localhost:8020/target/"});
  Assert.assertNull(options.getAtomicWorkPath());
  options = OptionsParser.parse(new String[] {
      "-atomic",
      "-tmp",
      "hdfs://localhost:8020/work",
      "hdfs://localhost:8020/source/first",
      "hdfs://localhost:8020/target/"});
  Assert.assertEquals(options.getAtomicWorkPath(), new Path("hdfs://localhost:8020/work"));
  try {
    OptionsParser.parse(new String[] {
        "-tmp",
        "hdfs://localhost:8020/work",
        "hdfs://localhost:8020/source/first",
        "hdfs://localhost:8020/target/"});
    Assert.fail("work path was allowed without -atomic switch");
  } catch (IllegalArgumentException ignore) {}
}