From 1b27de688ab89899ed2cd2c843b8148148e73ffc Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Thu, 16 Oct 2025 09:15:43 +0200 Subject: [PATCH] Add nullability annotations to tests in smoke-test/spring-boot-smoke-test-actuator-custom-security See gh-47263 --- .../build.gradle | 6 +++++- .../SampleActuatorCustomSecurityApplicationTests.java | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/smoke-test/spring-boot-smoke-test-actuator-custom-security/build.gradle b/smoke-test/spring-boot-smoke-test-actuator-custom-security/build.gradle index 6cae3245b3a..36c1ddd6c8c 100644 --- a/smoke-test/spring-boot-smoke-test-actuator-custom-security/build.gradle +++ b/smoke-test/spring-boot-smoke-test-actuator-custom-security/build.gradle @@ -30,4 +30,8 @@ dependencies { testImplementation(project(":starter:spring-boot-starter-test")) testRuntimeOnly("org.apache.httpcomponents.client5:httpclient5") -} \ No newline at end of file +} + +tasks.named("compileTestJava") { + options.nullability.checking = "tests" +} diff --git a/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/SampleActuatorCustomSecurityApplicationTests.java b/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/SampleActuatorCustomSecurityApplicationTests.java index b40505f56d4..e2e9becc893 100644 --- a/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/SampleActuatorCustomSecurityApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-actuator-custom-security/src/test/java/smoketest/actuator/customsecurity/SampleActuatorCustomSecurityApplicationTests.java @@ -52,6 +52,7 @@ class SampleActuatorCustomSecurityApplicationTests extends AbstractSampleActuato ResponseEntity entity = restTemplate().getForEntity(getPath() + "/foo", Map.class); assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR); Map body = entity.getBody(); + assertThat(body).isNotNull(); assertThat((String) body.get("message")).contains("Expected exception in controller"); }