From bdec5c14bbe791fc0b067cd6eb416ae32674bd27 Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Thu, 16 Oct 2025 09:50:27 +0200 Subject: [PATCH] Add nullability annotations to tests in smoke-test/spring-boot-smoke-test-tomcat See gh-47263 --- smoke-test/spring-boot-smoke-test-tomcat/build.gradle | 4 ++++ .../java/smoketest/tomcat/SampleTomcatApplicationTests.java | 1 + 2 files changed, 5 insertions(+) diff --git a/smoke-test/spring-boot-smoke-test-tomcat/build.gradle b/smoke-test/spring-boot-smoke-test-tomcat/build.gradle index f8d7ac4d22e..fc6c7957000 100644 --- a/smoke-test/spring-boot-smoke-test-tomcat/build.gradle +++ b/smoke-test/spring-boot-smoke-test-tomcat/build.gradle @@ -26,3 +26,7 @@ dependencies { testImplementation(project(":module:spring-boot-resttestclient")) testImplementation(project(":starter:spring-boot-starter-test")) } + +tasks.named("compileTestJava") { + options.nullability.checking = "tests" +} diff --git a/smoke-test/spring-boot-smoke-test-tomcat/src/test/java/smoketest/tomcat/SampleTomcatApplicationTests.java b/smoke-test/spring-boot-smoke-test-tomcat/src/test/java/smoketest/tomcat/SampleTomcatApplicationTests.java index da16800075a..a3ea2a1947d 100644 --- a/smoke-test/spring-boot-smoke-test-tomcat/src/test/java/smoketest/tomcat/SampleTomcatApplicationTests.java +++ b/smoke-test/spring-boot-smoke-test-tomcat/src/test/java/smoketest/tomcat/SampleTomcatApplicationTests.java @@ -98,6 +98,7 @@ class SampleTomcatApplicationTests { void testTimeout() { ServletWebServerApplicationContext context = (ServletWebServerApplicationContext) this.applicationContext; TomcatWebServer embeddedServletContainer = (TomcatWebServer) context.getWebServer(); + assertThat(embeddedServletContainer).isNotNull(); ProtocolHandler protocolHandler = embeddedServletContainer.getTomcat().getConnector().getProtocolHandler(); int timeout = ((AbstractProtocol) protocolHandler).getConnectionTimeout(); assertThat(timeout).isEqualTo(5000);