@Test
public void testDownloadAttachment() {

    addSelfLink(release);
    String attachmentId = "attach-9383764983";
    String fileName = "theAttachmentFile.tst";
    SW360SparseAttachment sparseAttachment = new SW360SparseAttachment();
    sparseAttachment.getLinks().setSelf(new Self("https://attachments.org/attachments/" + attachmentId));
    sparseAttachment.setFilename(fileName);
    Path orgPath = Paths.get("download");
    Path resultPath = Paths.get("downloadResult");
    when(releaseClient.processAttachment(eq(RELEASE_HREF), eq(attachmentId), any()))
            .thenReturn(CompletableFuture.completedFuture(resultPath));
    Optional<Path> downloadPath = block(releaseClientAdapter.downloadAttachment(release, sparseAttachment, orgPath));
    assertThat(downloadPath).isPresent();
    assertThat(downloadPath).hasValue(resultPath);
    ArgumentCaptor<SW360AttachmentUtils.AttachmentDownloadProcessorCreateDownloadFolder> captor =
            ArgumentCaptor.forClass(SW360AttachmentUtils.AttachmentDownloadProcessorCreateDownloadFolder.class);
    verify(releaseClient).processAttachment(eq(RELEASE_HREF), eq(attachmentId), captor.capture());
    SW360AttachmentUtils.AttachmentDownloadProcessorCreateDownloadFolder processor = captor.getValue();
    assertThat(processor.getDownloadPath()).isEqualTo(orgPath);
    assertThat(processor.getFileName()).isEqualTo(fileName);
    assertThat(processor.getCopyOptions()).contains(StandardCopyOption.REPLACE_EXISTING);
}