Fix test that fails when building against SNAPSHOT

Update `WarIntegrationTests` do deal with a SNAPSHOT Spring Framwork
dependency.

See gh-23936
pull/25075/head
Phillip Webb 4 years ago
parent 1eef2e1b46
commit d8b849e00d

@ -19,6 +19,7 @@ package org.springframework.boot.maven;
import java.io.File; import java.io.File;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.jar.JarFile; import java.util.jar.JarFile;
@ -111,9 +112,12 @@ class WarIntegrationTests extends AbstractArchiveIntegrationTests {
Map<String, List<String>> layerIndex = readLayerIndex(jarFile); Map<String, List<String>> layerIndex = readLayerIndex(jarFile);
assertThat(layerIndex.keySet()).containsExactly("dependencies", "spring-boot-loader", assertThat(layerIndex.keySet()).containsExactly("dependencies", "spring-boot-loader",
"snapshot-dependencies", "application"); "snapshot-dependencies", "application");
List<String> 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", 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"); "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")); .anyMatch((dependency) -> dependency.startsWith("WEB-INF/lib/spring-context"));
assertThat(layerIndex.get("dependencies")) assertThat(layerIndex.get("dependencies"))
.anyMatch((dependency) -> dependency.startsWith("WEB-INF/lib-provided/")); .anyMatch((dependency) -> dependency.startsWith("WEB-INF/lib-provided/"));

Loading…
Cancel
Save