From f5d6bea934deebcff3c9306761ac19390296bb70 Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Thu, 18 Sep 2025 12:23:30 +0200 Subject: [PATCH] Add nullability annotations to tests in module/spring-boot-couchbase See gh-47263 --- module/spring-boot-couchbase/build.gradle | 10 ++++++++++ .../health/CouchbaseReactiveHealthIndicatorTests.java | 2 ++ 2 files changed, 12 insertions(+) diff --git a/module/spring-boot-couchbase/build.gradle b/module/spring-boot-couchbase/build.gradle index ddc1b07bf55..ac4e2309c45 100644 --- a/module/spring-boot-couchbase/build.gradle +++ b/module/spring-boot-couchbase/build.gradle @@ -44,5 +44,15 @@ dependencies { testImplementation(project(":core:spring-boot-test")) testImplementation(project(":test-support:spring-boot-test-support")) + testCompileOnly("com.google.code.findbugs:jsr305") + testRuntimeOnly("ch.qos.logback:logback-classic") } + +tasks.named("compileTestJava") { + options.nullability.checking = "tests" +} + +tasks.named("compileDockerTestJava") { + options.nullability.checking = "tests" +} diff --git a/module/spring-boot-couchbase/src/test/java/org/springframework/boot/couchbase/health/CouchbaseReactiveHealthIndicatorTests.java b/module/spring-boot-couchbase/src/test/java/org/springframework/boot/couchbase/health/CouchbaseReactiveHealthIndicatorTests.java index 2e6732c14a8..ebac32f3dc3 100644 --- a/module/spring-boot-couchbase/src/test/java/org/springframework/boot/couchbase/health/CouchbaseReactiveHealthIndicatorTests.java +++ b/module/spring-boot-couchbase/src/test/java/org/springframework/boot/couchbase/health/CouchbaseReactiveHealthIndicatorTests.java @@ -60,6 +60,7 @@ class CouchbaseReactiveHealthIndicatorTests { given(reactiveCluster.diagnostics()).willReturn(Mono.just(diagnostics)); given(cluster.reactive()).willReturn(reactiveCluster); Health health = healthIndicator.health().block(Duration.ofSeconds(30)); + assertThat(health).isNotNull(); assertThat(health.getStatus()).isEqualTo(Status.UP); assertThat(health.getDetails()).containsEntry("sdk", "test-sdk"); assertThat(health.getDetails()).containsKey("endpoints"); @@ -85,6 +86,7 @@ class CouchbaseReactiveHealthIndicatorTests { given(reactiveCluster.diagnostics()).willReturn(Mono.just(diagnostics)); given(cluster.reactive()).willReturn(reactiveCluster); Health health = healthIndicator.health().block(Duration.ofSeconds(30)); + assertThat(health).isNotNull(); assertThat(health.getStatus()).isEqualTo(Status.DOWN); assertThat(health.getDetails()).containsEntry("sdk", "test-sdk"); assertThat(health.getDetails()).containsKey("endpoints");