### Question:
DatabaseBlobBinaryStorageSvcImpl extends BaseBinaryStorageSvcImpl { byte[] copyBlobToByteArray(BinaryStorageEntity theEntity) throws IOException { int size = theEntity.getSize(); try { return IOUtils.toByteArray(theEntity.getBlob().getBinaryStream(), size); } 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 testCopyBlobToByteArray_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.copyBlobToByteArray(mockInput); fail(); } catch (IOException e) { assertThat(e.getMessage(), containsString("FOO")); } }