### Question:
StreamToFSTransferClient implements StreamTransferClient { @Override public URI transfer(PID binPid, InputStream sourceStream) { return writeStream(binPid, sourceStream, false); } StreamToFSTransferClient(StorageLocation destination); @Override URI transfer(PID binPid, InputStream sourceStream); @Override URI transferReplaceExisting(PID binPid, InputStream sourceStream); @Override URI transferVersion(PID binPid, InputStream sourceStream); @Override void shutdown(); @Override void delete(URI fileUri); @Override BinaryDetails getStoredBinaryDetails(PID binPid);  }### Answer:
@Test public void transfer_NewFile() throws Exception { InputStream sourceStream = toStream(STREAM_CONTENT); client.transfer(binPid, sourceStream); assertContent(binDestPath, STREAM_CONTENT); }
@Test(expected = BinaryAlreadyExistsException.class) public void transfer_ExistingFile() throws Exception { createFile(); InputStream sourceStream = toStream(STREAM_CONTENT); try { client.transfer(binPid, sourceStream); } finally { assertContent(binDestPath, ORIGINAL_CONTENT); } }
@Test(expected = BinaryTransferException.class) public void transfer_StreamThrowsException() throws Exception { InputStream sourceStream = mock(InputStream.class); when(sourceStream.read(any())).thenThrow(new IOException()); client.transfer(binPid, sourceStream); assertContent(binDestPath, STREAM_CONTENT); }