diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleBuild.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleBuild.java index 4f38422b81..bec4ca1354 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleBuild.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-test-support/src/main/java/org/springframework/boot/testsupport/gradle/testkit/GradleBuild.java @@ -80,6 +80,8 @@ public class GradleBuild { private GradleVersion expectDeprecationWarnings; + private String[] expectedDeprecationMessages; + private boolean configurationCache = false; private Map scriptProperties = new HashMap<>(); @@ -152,6 +154,11 @@ public class GradleBuild { return this; } + public GradleBuild expectDeprecationMessages(String... messages) { + this.expectedDeprecationMessages = messages; + return this; + } + public GradleBuild configurationCache() { this.configurationCache = true; return this; @@ -167,7 +174,13 @@ public class GradleBuild { BuildResult result = prepareRunner(arguments).build(); if (this.expectDeprecationWarnings == null || (this.gradleVersion != null && this.expectDeprecationWarnings.compareTo(GradleVersion.version(this.gradleVersion)) > 0)) { - assertThat(result.getOutput()).doesNotContain("Deprecated").doesNotContain("deprecated"); + String buildOutput = result.getOutput(); + if (this.expectedDeprecationMessages != null) { + for (String message : this.expectedDeprecationMessages) { + buildOutput = buildOutput.replaceAll(message, ""); + } + } + assertThat(buildOutput).doesNotContain("Deprecated").doesNotContain("deprecated"); } return result; } diff --git a/spring-boot-system-tests/spring-boot-image-tests/src/systemTest/java/org/springframework/boot/image/paketo/PaketoBuilderTests.java b/spring-boot-system-tests/spring-boot-image-tests/src/systemTest/java/org/springframework/boot/image/paketo/PaketoBuilderTests.java index 9dc2a856ae..6192600cff 100644 --- a/spring-boot-system-tests/spring-boot-image-tests/src/systemTest/java/org/springframework/boot/image/paketo/PaketoBuilderTests.java +++ b/spring-boot-system-tests/spring-boot-image-tests/src/systemTest/java/org/springframework/boot/image/paketo/PaketoBuilderTests.java @@ -125,6 +125,7 @@ class PaketoBuilderTests { container.waitingFor(Wait.forHttp("/test")).start(); container.stop(); } + this.gradleBuild.expectDeprecationMessages("BOM table is deprecated in this buildpack api version"); result = buildImage(imageName); assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS); try (GenericContainer container = new GenericContainer<>(imageName).withExposedPorts(8080)) {