@Test
public void testPathsAreSanitizedWhenRemovingUnreferencedFiles() {

    SW360Release release = new SW360Release();
    release.setName("org.apache.commons/commons-lang3");
    release.setVersion("3.*");
    Path delPath1 = sourcePath.resolve("org.apache.commons");
    Path delPath2 = delPath1.resolve("commons-lang3");
    Path delPath3 = createTestFile(delPath2.resolve("lang-source.zip"));
    Path validPath1 = sourcePath.resolve("org.apache.commons_commons-lang3").resolve("3._");
    Path validPath2 = createTestFile(validPath1.resolve("lang-source.zip"));
    Set<SW360SparseAttachment> attachments = createAttachments(1, 1);
    initAttachments(release, attachments);
    ReleaseWithSources releaseWithSources = createReleaseWithSources(release, attachments);
    sourcesExporter.removeUnreferencedFiles(Collections.singleton(releaseWithSources));
    assertThat(checkFileExists(validPath1)).isTrue();
    assertThat(checkFileExists(validPath2)).isTrue();
    assertThat(checkFileExists(delPath3)).isFalse();
    assertThat(checkFileExists(delPath2)).isFalse();
    assertThat(checkFileExists(delPath1)).isFalse();
}