From d8b849e00dd5612cb0aa9f997f271cc9ab4f3287 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Mon, 1 Feb 2021 22:09:04 -0800 Subject: [PATCH] Fix test that fails when building against SNAPSHOT Update `WarIntegrationTests` do deal with a SNAPSHOT Spring Framwork dependency. See gh-23936 --- .../org/springframework/boot/maven/WarIntegrationTests.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/WarIntegrationTests.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/WarIntegrationTests.java index d4fc82415b..be81e13566 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/WarIntegrationTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/WarIntegrationTests.java @@ -19,6 +19,7 @@ package org.springframework.boot.maven; import java.io.File; import java.io.FileReader; import java.io.IOException; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.jar.JarFile; @@ -111,9 +112,12 @@ class WarIntegrationTests extends AbstractArchiveIntegrationTests { Map> layerIndex = readLayerIndex(jarFile); assertThat(layerIndex.keySet()).containsExactly("dependencies", "spring-boot-loader", "snapshot-dependencies", "application"); + List dependenciesAndSnapshotDependencies = new ArrayList<>(); + dependenciesAndSnapshotDependencies.addAll(layerIndex.get("dependencies")); + dependenciesAndSnapshotDependencies.addAll(layerIndex.get("snapshot-dependencies")); assertThat(layerIndex.get("application")).contains("WEB-INF/lib/jar-release-0.0.1.RELEASE.jar", "WEB-INF/lib/jar-snapshot-0.0.1.BUILD-SNAPSHOT.jar"); - assertThat(layerIndex.get("dependencies")) + assertThat(dependenciesAndSnapshotDependencies) .anyMatch((dependency) -> dependency.startsWith("WEB-INF/lib/spring-context")); assertThat(layerIndex.get("dependencies")) .anyMatch((dependency) -> dependency.startsWith("WEB-INF/lib-provided/"));