@Test
public void testUpdaterArtifactToReleaseDeleteSources() throws IOException {

    Path sourceFile = createTestFile();
    Artifact artifact = TestUtils.mkArtifact("test", false);
    artifact.addFact(new ArtifactSourceFile(sourceFile));
    SW360Release release = createRelease("test", sourceFile);
    SW360Release createdRelease = createRelease("testCreated", sourceFile);
    SW360Release srcDeletedRelease = createRelease("testAttachmentsDeleted", sourceFile);
    SW360Release updatedRelease = createRelease("testUpdated", sourceFile);
    Map<Path, SW360AttachmentType> uploadMap = Collections.singletonMap(sourceFile, SW360AttachmentType.SOURCE);
    AttachmentUploadResult<SW360Release> uploadResult = new AttachmentUploadResult<>(updatedRelease);
    when(metaDataUpdater.getOrCreateRelease(release, false))
            .thenReturn(createdRelease);
    when(metaDataUpdater.deleteAttachments(eq(createdRelease), any())).thenReturn(srcDeletedRelease);
    when(metaDataUpdater.uploadAttachments(srcDeletedRelease, uploadMap, true))
            .thenReturn(uploadResult);
    SW360UpdaterImpl updater = new SW360UpdaterImpl(metaDataUpdater, "test", "version",
            false, true, true);
    AttachmentUploadResult<SW360Release> result =
            updater.artifactToReleaseWithUploads(artifact, release, uploadMap);
    assertThat(result).isEqualTo(uploadResult);
    Predicate<SW360SparseAttachment> predicate = extractPredicateForDeleteAttachments(createdRelease);
    assertThat(predicate.test(createAttachment(Paths.get("foo"), SW360AttachmentType.SOURCE)))
            .isTrue();
    assertThat(predicate.test(createAttachment(sourceFile, SW360AttachmentType.SOURCE)))
            .isFalse();
}