IArtifactRequester { String getExpectedJarBaseName(Coordinate mavenCoordinate, ClassifierInformation classifierInformation) { return mavenCoordinate.getName() + "-" + mavenCoordinate.getVersion() + (classifierInformation.classifier.isEmpty() ? JAR_EXTENSION : "-" + classifierInformation.classifier + JAR_EXTENSION); } IArtifactRequester(); abstract Optional<File> requestFile(Coordinate mavenCoordinate, Path targetDirectory, ClassifierInformation classifierInformation); static final String JAR_EXTENSION; }
@Test public void getExpectedJarBaseNameTest() { final String expectedJarBaseName = artifactRequester.getExpectedJarBaseName(mavenCoordinate, ClassifierInformation.DEFAULT_JAR); assertThat(expectedJarBaseName).endsWith(MavenInvokerRequester.JAR_EXTENSION); assertThat(expectedJarBaseName).contains(mavenCoordinate.getName()); assertThat(expectedJarBaseName).contains(mavenCoordinate.getVersion()); assertThat(expectedJarBaseName).doesNotContain("/"); }
@Test public void getExpectedJarBaseNameTestSource() { final String expectedJarBaseName = artifactRequester.getExpectedJarBaseName(mavenCoordinate, ClassifierInformation.DEFAULT_SOURCE_JAR); assertThat(expectedJarBaseName).endsWith("-sources" + MavenInvokerRequester.JAR_EXTENSION); assertThat(expectedJarBaseName).contains(mavenCoordinate.getName()); assertThat(expectedJarBaseName).contains(mavenCoordinate.getVersion()); assertThat(expectedJarBaseName).doesNotContain("/"); }