@Test
public void testSetOverwrite() {

  final DistCpOptions.Builder builder = new DistCpOptions.Builder(
      Collections.singletonList(new Path("hdfs://localhost:8020/source")),
      new Path("hdfs://localhost:8020/target/"));
  Assert.assertFalse(builder.build().shouldOverwrite());
  builder.withOverwrite(true);
  Assert.assertTrue(builder.build().shouldOverwrite());
  try {
    builder.withSyncFolder(true).build();
    Assert.fail("Update and overwrite aren't allowed together");
  } catch (IllegalArgumentException ignore) {
  }
}