ArtifactPathHelper { @NotNull String concatenateArtifactPath(@NotNull final String fileNamePrefix, @NotNull final String pdbFileName) { final String normalizedFileNamePrefix = fileNamePrefix.replace(ARCHIVE_PATH_SEPARATOR, ARCHIVE_PATH_SEPARATOR_FULL); if (StringUtil.isEmpty(normalizedFileNamePrefix)) { return pdbFileName; } final String archivePath = getArchivePath(normalizedFileNamePrefix); if (archivePath == null || normalizedFileNamePrefix.contains(ARCHIVE_PATH_SEPARATOR_FULL)) { return normalizedFileNamePrefix + FOLDER_SEPARATOR + pdbFileName; } return archivePath + ARCHIVE_PATH_SEPARATOR + StringUtil.trimStart(normalizedFileNamePrefix, archivePath) + FOLDER_SEPARATOR + pdbFileName; } ArtifactPathHelper(@NotNull final ExtensionHolder extensions);   }
@Test(dataProvider = "testPaths") public void testPathTransformation(String prefix, String fileName, String expectedPath) { Mockery m = new Mockery(); ExtensionHolder extensionHolder = m.mock(ExtensionHolder.class); BuildProgressLogger logger = m.mock(BuildProgressLogger.class); InternalPropertiesHolder propertiesHolder = m.mock(InternalPropertiesHolder.class); ArtifactPathHelper helper = new ArtifactPathHelper(extensionHolder); ZipPreprocessor zipPreprocessor = new ZipPreprocessor(logger, new File("."), propertiesHolder); m.checking(new Expectations(){{ allowing(extensionHolder).getExtensions(with(ArchivePreprocessor.class)); will(returnValue(Collections.singletonList(zipPreprocessor))); }}); Assert.assertEquals(helper.concatenateArtifactPath(prefix, fileName), expectedPath); }