@Test
public void testDownloadIfHashCalculationFails() {

    SW360SparseAttachment attachment = createAttachment(1, 1);
    attachment.setSha1(TEST_FILE_SHA1);
    Set<SW360SparseAttachment> attachments = Collections.singleton(attachment);
    SW360Release release = createReleaseWithAttachments(1, attachments);
    ReleaseWithSources releaseWithSources =
            createReleaseWithSources(release, attachments);
    createTestFile(sourcePath.resolve(attachment.getFilename()));
    expectDownloads(release, attachments);
    sourcesExporter = new SourcesExporter(sourcePath) {
        @Override
        String calculateLocalAttachmentHash(Path localPath) {
            throw new SW360ClientException("Hash failure");
        }
    };
    Collection<ReleaseWithSources> result =
            sourcesExporter.downloadSources(releaseAdapter, Collections.singleton(release));
    assertThat(result).containsOnly(releaseWithSources);
    verify(releaseAdapter).processAttachment(eq(release), eq(attachment.getAttachmentId()),
            any(SW360AttachmentUtils.AttachmentDownloadProcessorCreateDownloadFolderWithParents.class));
}