### Question:
SimpleCopyListing extends CopyListing { @Override public void doBuildListing(Path pathToListingFile, S3MapReduceCpOptions options) throws IOException { doBuildListing(getWriter(pathToListingFile), options); } protected  SimpleCopyListing(Configuration configuration, Credentials credentials); @Override void doBuildListing(Path pathToListingFile, S3MapReduceCpOptions options); @VisibleForTesting void doBuildListing(SequenceFile.Writer fileListWriter, S3MapReduceCpOptions options); @VisibleForTesting void doBuildListing(SequenceFile.Writer fileListWriter, S3MapReduceCpOptions options, List<Path> globbedPaths); static final String CONF_LABEL_ROOT_PATH; }### Answer:
@Test public void failOnCloseError() throws IOException { File inFile = File.createTempFile("TestCopyListingIn", null); inFile.deleteOnExit(); File outFile = File.createTempFile("TestCopyListingOut", null); outFile.deleteOnExit(); Path source = new Path(inFile.toURI()); Exception expectedEx = new IOException("boom"); SequenceFile.Writer writer = mock(SequenceFile.Writer.class); doThrow(expectedEx).when(writer).close(); Exception actualEx = null; try { listing.doBuildListing(writer, options(source, outFile.toURI())); } catch (Exception e) { actualEx = e; } Assert.assertNotNull("close writer didn't fail", actualEx); Assert.assertEquals(expectedEx, actualEx); }