### Question:
DatabaseBlobBinaryStorageSvcImpl extends BaseBinaryStorageSvcImpl { void copyBlobToOutputStream(OutputStream theOutputStream, BinaryStorageEntity theEntity) throws IOException { try (InputStream inputStream = theEntity.getBlob().getBinaryStream()) { IOUtils.copy(inputStream, theOutputStream); } catch (SQLException e) { throw new IOException(e); } }  @Override @Transactional(Transactional.TxType.REQUIRED) StoredDetails storeBlob(IIdType theResourceId, String theBlobIdOrNull, String theContentType, InputStream theInputStream); @Override StoredDetails fetchBlobDetails(IIdType theResourceId, String theBlobId); @Override boolean writeBlob(IIdType theResourceId, String theBlobId, OutputStream theOutputStream); @Override void expungeBlob(IIdType theResourceId, String theBlobId); @Override byte[] fetchBlob(IIdType theResourceId, String theBlobId);  }### Answer:
@Test public void testCopyBlobToOutputStream_Exception() throws SQLException { DatabaseBlobBinaryStorageSvcImpl svc = new DatabaseBlobBinaryStorageSvcImpl(); BinaryStorageEntity mockInput = new BinaryStorageEntity(); Blob blob = mock(Blob.class); when(blob.getBinaryStream()).thenThrow(new SQLException("FOO")); mockInput.setBlob(blob); try { svc.copyBlobToOutputStream(new ByteArrayOutputStream(), (mockInput)); fail(); } catch (IOException e) { assertThat(e.getMessage(), containsString("FOO")); } }