### Question:
S3RecoverableFsDataOutputStream extends RecoverableFsDataOutputStream { @Override public Committer closeForCommit() throws IOException { lock(); try { closeAndUploadPart(); return upload.snapshotAndGetCommitter(); } finally { unlock(); } } S3RecoverableFsDataOutputStream(
			RecoverableMultiPartUpload upload,
			FunctionWithException<File, RefCountedFile, IOException> tempFileCreator,
			RefCountedFSOutputStream initialTmpFile,
			long userDefinedMinPartSize,
			long bytesBeforeCurrentPart); @Override void write(int b); @Override void write(byte[] b, int off, int len); @Override void flush(); @Override long getPos(); @Override void sync(); @Override void close(); @Override RecoverableWriter.ResumeRecoverable persist(); @Override Committer closeForCommit(); static S3RecoverableFsDataOutputStream newStream(
			final RecoverableMultiPartUpload upload,
			final FunctionWithException<File, RefCountedFile, IOException> tmpFileCreator,
			final long userDefinedMinPartSize); static S3RecoverableFsDataOutputStream recoverStream(
			final RecoverableMultiPartUpload upload,
			final FunctionWithException<File, RefCountedFile, IOException> tmpFileCreator,
			final long userDefinedMinPartSize,
			final long bytesBeforeCurrentPart);  }### Answer:
@Test public void noWritesShouldResolveInAnEmptyFile() throws IOException { RecoverableFsDataOutputStream.Committer committer = streamUnderTest.closeForCommit(); committer.commit(); assertThat(multipartUploadUnderTest, hasContent(new byte[0])); }
@Test public void commitEmptyStreamShouldBeSuccessful() throws IOException { streamUnderTest.closeForCommit().commit(); }
@Test(expected = IOException.class) public void closeForCommitOnClosedStreamShouldFail() throws IOException { streamUnderTest.closeForCommit().commit(); streamUnderTest.closeForCommit().commit(); }