### Question:
DistCpOptions { public boolean shouldAppend() { return append; } private  DistCpOptions(Builder builder); Path getSourceFileListing(); List<Path> getSourcePaths(); Path getTargetPath(); boolean shouldAtomicCommit(); Path getAtomicWorkPath(); boolean shouldSyncFolder(); boolean shouldDeleteMissing(); boolean shouldIgnoreFailures(); boolean shouldOverwrite(); boolean shouldAppend(); boolean shouldSkipCRC(); boolean shouldBlock(); boolean shouldUseDiff(); boolean shouldUseRdiff(); boolean shouldUseSnapshotDiff(); String getFromSnapshot(); String getToSnapshot(); String getFiltersFile(); Path getLogPath(); String getCopyStrategy(); int getNumListstatusThreads(); int getMaxMaps(); float getMapBandwidth(); Set<FileAttribute> getPreserveAttributes(); boolean shouldPreserve(FileAttribute attribute); int getBlocksPerChunk(); int getCopyBufferSize(); boolean shouldVerboseLog(); Path getTrackPath(); boolean shouldDirectWrite(); void appendToConf(Configuration conf); @Override String toString(); static final int MAX_NUM_LISTSTATUS_THREADS; }### Answer:
@Test public void testAppendOption() { final DistCpOptions.Builder builder = new DistCpOptions.Builder( Collections.singletonList(new Path("hdfs: new Path("hdfs: .withSyncFolder(true) .withAppend(true); Assert.assertTrue(builder.build().shouldAppend()); try { new DistCpOptions.Builder( Collections.singletonList(new Path("hdfs: new Path("hdfs: .withAppend(true) .build(); fail("Append should fail if update option is not specified"); } catch (IllegalArgumentException e) { assertExceptionContains( "Append is valid only with update options", e); } try { new DistCpOptions.Builder( Collections.singletonList(new Path("hdfs: new Path("hdfs: .withSyncFolder(true) .withAppend(true) .withCRC(true) .build(); fail("Append should fail if skipCrc option is specified"); } catch (IllegalArgumentException e) { assertExceptionContains( "Append is disallowed when skipping CRC", e); } }