@Test
public void testExceptionsDuringAttachmentDownloadAreHandled() {

    Set<SW360SparseAttachment> sourceAttachments = createAttachments(1, 2);
    SW360SparseAttachment failedAttachment = createAttachment(1, 42);
    Set<SW360SparseAttachment> attachments = new HashSet<>(sourceAttachments);
    attachments.add(failedAttachment);
    SW360Release release = createReleaseWithAttachments(1, attachments);
    ReleaseWithSources releaseWithSources = createReleaseWithSources(release, sourceAttachments);
    expectDownloads(release, sourceAttachments);
    when(releaseAdapter.processAttachment(eq(release), eq(failedAttachment.getAttachmentId()), any()))
            .thenReturn(failedFuture(new IOException("Download failed")));
    Collection<ReleaseWithSources> result =
            sourcesExporter.downloadSources(releaseAdapter, Collections.singleton(release));
    assertThat(result).containsOnly(releaseWithSources);
}