From 0d44ac893fc965ea41c60f280b3fe49f579bf8a6 Mon Sep 17 00:00:00 2001 From: sullis Date: Sun, 15 Dec 2024 11:12:32 -0800 Subject: [PATCH] check for build success --- .../spring/ProjectGeneratorIntegrationTests.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/initializr-generator-spring/src/test/java/io/spring/initializr/generator/spring/ProjectGeneratorIntegrationTests.java b/initializr-generator-spring/src/test/java/io/spring/initializr/generator/spring/ProjectGeneratorIntegrationTests.java index 80906a1cb9..95b8fb51d5 100644 --- a/initializr-generator-spring/src/test/java/io/spring/initializr/generator/spring/ProjectGeneratorIntegrationTests.java +++ b/initializr-generator-spring/src/test/java/io/spring/initializr/generator/spring/ProjectGeneratorIntegrationTests.java @@ -37,6 +37,7 @@ import org.junit.jupiter.api.io.TempDir; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Fail.fail; /** * Tests for {@link ProjectGenerator} that uses all available @@ -106,6 +107,16 @@ private void runBuild(Path mavenHome, Path projectDirectory, MutableProjectDescr processBuilder.redirectOutput(output.toFile()); assertThat(processBuilder.start().waitFor()).describedAs(String.join("\n", Files.readAllLines(output))) .isEqualTo(0); + + if (description.getBuildSystem().id().equals(GradleBuildSystem.ID)) { + assertThat(output.toFile()).content().contains("BUILD SUCCESSFUL"); + } + else if (description.getBuildSystem().id().equals(MavenBuildSystem.ID)) { + assertThat(output.toFile()).content().contains("BUILD SUCCESS"); + } + else { + fail("unexpected Build System: " + description.getBuildSystem().id()); + } } private ProcessBuilder createProcessBuilder(Path directory, BuildSystem buildSystem, Path home) {