From f51018fa29ec0e9ab42b87c2139fbbc66b8f8208 Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Wed, 15 Oct 2025 12:30:56 +0200 Subject: [PATCH] Add nullability annotations to tests in module/spring-boot-security-test See gh-47263 --- module/spring-boot-security-test/build.gradle | 4 ++++ .../webflux/WebTestClientSecurityIntegrationTests.java | 3 +++ 2 files changed, 7 insertions(+) diff --git a/module/spring-boot-security-test/build.gradle b/module/spring-boot-security-test/build.gradle index 51f12b8b147..9932ee80b32 100644 --- a/module/spring-boot-security-test/build.gradle +++ b/module/spring-boot-security-test/build.gradle @@ -40,3 +40,7 @@ dependencies { testRuntimeOnly("ch.qos.logback:logback-classic") } + +tasks.named("compileTestJava") { + options.nullability.checking = "tests" +} diff --git a/module/spring-boot-security-test/src/test/java/org/springframework/boot/security/test/autoconfigure/webflux/WebTestClientSecurityIntegrationTests.java b/module/spring-boot-security-test/src/test/java/org/springframework/boot/security/test/autoconfigure/webflux/WebTestClientSecurityIntegrationTests.java index c470714c97d..708c6f216a4 100644 --- a/module/spring-boot-security-test/src/test/java/org/springframework/boot/security/test/autoconfigure/webflux/WebTestClientSecurityIntegrationTests.java +++ b/module/spring-boot-security-test/src/test/java/org/springframework/boot/security/test/autoconfigure/webflux/WebTestClientSecurityIntegrationTests.java @@ -51,9 +51,12 @@ class WebTestClientSecurityIntegrationTests { WebTestClient webTestClient = context.getBean(WebTestClient.class); WebTestClient.Builder builder = (WebTestClient.Builder) ReflectionTestUtils.getField(webTestClient, "builder"); + assertThat(builder).isNotNull(); WebHttpHandlerBuilder httpHandlerBuilder = (WebHttpHandlerBuilder) ReflectionTestUtils.getField(builder, "httpHandlerBuilder"); + assertThat(httpHandlerBuilder).isNotNull(); List filters = (List) ReflectionTestUtils.getField(httpHandlerBuilder, "filters"); + assertThat(filters).isNotNull(); assertThat(filters.get(0).getClass().getName()).isEqualTo( "org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers$MutatorFilter"); });