Skip to content

Commit b351288

Browse files
committed
Fix integration test app detection
See gh-18631
1 parent a2a153a commit b351288

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/intTest/java/org/springframework/boot/launchscript/AbstractLaunchScriptIntegrationTests.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import org.testcontainers.utility.MountableFile;
3131

3232
import org.springframework.boot.ansi.AnsiColor;
33+
import org.springframework.util.Assert;
3334

3435
import static org.assertj.core.api.Assertions.assertThat;
3536
import static org.hamcrest.Matchers.containsString;
@@ -110,12 +111,10 @@ private LaunchScriptTestContainer(String os, String version, String scriptsDir,
110111
}
111112

112113
private static File findApplication() {
113-
File appJar = new File("build/app/build/libs/app.jar");
114-
if (appJar.isFile()) {
115-
return appJar;
116-
}
117-
throw new IllegalStateException(
118-
"Could not find test application in build/app/build/libs directory. Have you built it?");
114+
String name = String.format("build/%1$s/build/libs/%1$s.jar", "spring-boot-launch-script-tests-app");
115+
File jar = new File(name);
116+
Assert.state(jar.isFile(), () -> "Could not find " + name + ". Have you built it?");
117+
return jar;
119118
}
120119

121120
}

spring-boot-tests/spring-boot-integration-tests/spring-boot-loader-tests/src/intTest/java/org/springframework/boot/loader/LoaderIntegrationTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
import org.testcontainers.utility.DockerImageName;
2929
import org.testcontainers.utility.MountableFile;
3030

31+
import org.springframework.util.Assert;
32+
3133
import static org.assertj.core.api.Assertions.assertThat;
3234

3335
/**
@@ -49,12 +51,10 @@ class LoaderIntegrationTests {
4951
.withCommand("java", "-jar", "app.jar");
5052

5153
private static File findApplication() {
52-
File appJar = new File("build/app/build/libs/app.jar");
53-
if (appJar.isFile()) {
54-
return appJar;
55-
}
56-
throw new IllegalStateException(
57-
"Could not find test application in build/app/build/libs directory. Have you built it?");
54+
String name = String.format("build/%1$s/build/libs/%1$s.jar", "spring-boot-loader-tests-app");
55+
File jar = new File(name);
56+
Assert.state(jar.isFile(), () -> "Could not find " + name + ". Have you built it?");
57+
return jar;
5858
}
5959

6060
@Test

0 commit comments

Comments
 (0)