SW360MetaDataReceiver { public Optional<Path> downloadAttachment(SW360Release release, SW360SparseAttachment attachment, Path downloadPath) { return releaseClientAdapter.downloadAttachment(release, attachment, downloadPath); } SW360MetaDataReceiver(SW360Connection sw360ConnectionConfiguration); Optional<SW360Release> findReleaseForArtifact(Artifact artifact); Optional<SW360License> getLicenseDetails(SW360SparseLicense sparseLicense); Optional<Path> downloadAttachment(SW360Release release, SW360SparseAttachment attachment, Path downloadPath);  }
@Test public void testDownloadAttachment() { final Path downloadPath = Paths.get(""); final SW360Release release = new SW360Release(); final SW360SparseAttachment attachment = new SW360SparseAttachment().setFilename("attachmentFile.file"); final Path attachmentPath = downloadPath.resolve(attachment.getFilename()); when(releaseClientAdapter.downloadAttachment(release, attachment, downloadPath)) .thenReturn(Optional.of(attachmentPath)); setUp(); final Optional<Path> downloadedAttachmentPath = metaDataReceiver.downloadAttachment(release, attachment, downloadPath); assertThat(downloadedAttachmentPath).isPresent(); assertThat(downloadedAttachmentPath).hasValue(attachmentPath); verify(releaseClientAdapter, times(1)).downloadAttachment(release, attachment, downloadPath); }