@Test
public void testExceptionsWhenCalculatingAttachmentHashAreHandled() throws IOException {

    final String attachmentFileName = "failingHashAttachmentFileName.doc";
    SW360Release release = addSourceAttachment(createRelease(RELEASE_NAME), attachmentFileName);
    Path uploadPath = createTestFile(attachmentPath(attachmentFileName), TEST_FILE_CONTENT);
    Map<Path, SW360AttachmentType> attachments = Collections.singletonMap(uploadPath, SW360AttachmentType.SOURCE);
    AttachmentUploadRequest<SW360Release> expRequest = AttachmentUploadRequest.builder(release)
            .addAttachment(uploadPath, SW360AttachmentType.SOURCE)
            .build();
    when(releaseClientAdapter.uploadAttachments(expRequest))
            .thenReturn(new AttachmentUploadResult<>(release));
    metaDataUpdater = new SW360MetaDataUpdater(connection) {
        @Override
        String calculateAttachmentHash(Path path) {
            throw new SW360ClientException("Hash failed");
        }
    };
    metaDataUpdater.uploadAttachments(release, attachments, true);
    verify(releaseClientAdapter).uploadAttachments(expRequest);
}