Skip to content

Commit

Permalink
Fix the test
Browse files Browse the repository at this point in the history
  • Loading branch information
shanman190 committed Jul 17, 2023
1 parent a41cafa commit cbdb097
Showing 1 changed file with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -407,10 +407,11 @@ void defaultsToLatestRelease() {

var mavenWrapperJar = result(run, Remote.class, "maven-wrapper.jar");
assertThat(mavenWrapperJar.getSourcePath()).isEqualTo(WRAPPER_JAR_LOCATION);
//noinspection OptionalGetWithoutIsPresent
BuildTool buildTool = mavenWrapperJar.getMarkers().findFirst(BuildTool.class).get();
assertThat(buildTool.getVersion()).isNotEqualTo("3.8.0");
assertThat(mavenWrapperJar.getUri()).isEqualTo(URI.create("https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/" + buildTool.getVersion() + "/maven-wrapper-" + buildTool.getVersion() + ".jar"));
Matcher wrapperVersionMatcher = Pattern.compile("maven-wrapper-(.*?)\\.jar").matcher(mavenWrapperJar.getUri().toString());
assertThat(wrapperVersionMatcher.find()).isTrue();
String wrapperVersion = wrapperVersionMatcher.group(1);
assertThat(wrapperVersion).isNotEqualTo("3.1.1");
assertThat(mavenWrapperJar.getUri()).isEqualTo(URI.create("https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/" + wrapperVersion + "/maven-wrapper-" + wrapperVersion + ".jar"));
assertThat(isValidWrapperJar(mavenWrapperJar)).as("Wrapper jar is not valid").isTrue();
}),
properties(
Expand All @@ -422,7 +423,7 @@ void defaultsToLatestRelease() {
"""),
spec -> spec.path(".mvn/wrapper/maven-wrapper.properties")
.after(after -> {
Matcher distributionVersionMatcher = Pattern.compile("apache-maven-(.*?)-bin.zip").matcher(after);
Matcher distributionVersionMatcher = Pattern.compile("apache-maven-(.*?)-bin\\.zip").matcher(after);
assertThat(distributionVersionMatcher.find()).isTrue();
String mavenDistributionVersion = distributionVersionMatcher.group(1);
assertThat(mavenDistributionVersion).isNotEqualTo("3.8.0");
Expand All @@ -432,7 +433,7 @@ void defaultsToLatestRelease() {
String distributionChecksum = distributionChecksumMatcher.group(1);
assertThat(distributionChecksum).isNotBlank();

Matcher wrapperVersionMatcher = Pattern.compile("maven-wrapper-(.*?).jar").matcher(after);
Matcher wrapperVersionMatcher = Pattern.compile("maven-wrapper-(.*?)\\.jar").matcher(after);
assertThat(wrapperVersionMatcher.find()).isTrue();
String wrapperVersion = wrapperVersionMatcher.group(1);
assertThat(wrapperVersion).isNotEqualTo("3.1.1");
Expand All @@ -442,12 +443,12 @@ void defaultsToLatestRelease() {
String wrapperChecksum = wrapperChecksumMatcher.group(1);
assertThat(wrapperChecksum).isNotBlank();

return """
return withLicenseHeader("""
distributionUrl=https\\://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/%s/apache-maven-%s-bin.zip
wrapperUrl=https\\://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/%s/maven-wrapper-%s.jar
distributionSha256Sum=%s
wrapperSha256Sum=%s
""".formatted(mavenDistributionVersion, mavenDistributionVersion, wrapperVersion, wrapperVersion, distributionChecksum, wrapperChecksum);
""".formatted(mavenDistributionVersion, mavenDistributionVersion, wrapperVersion, wrapperVersion, distributionChecksum, wrapperChecksum));
})
),
mvnw,
Expand Down

0 comments on commit cbdb097

Please sign in to comment.