Add nullability annotations to tests in module/spring-boot-cassandra

See gh-47263
This commit is contained in:
Moritz Halbritter 2025-09-18 12:16:17 +02:00
parent f8ce17c751
commit b6950f8fb0
3 changed files with 14 additions and 2 deletions

View File

@ -48,3 +48,11 @@ dependencies {
testRuntimeOnly("ch.qos.logback:logback-classic")
}
tasks.named("compileTestJava") {
options.nullability.checking = "tests"
}
tasks.named("compileDockerTestJava") {
options.nullability.checking = "tests"
}

View File

@ -48,8 +48,10 @@ import static org.mockito.Mockito.mock;
class CassandraDriverHealthIndicatorTests {
@Test
@SuppressWarnings("NullAway") // Test null check
void createWhenCqlSessionIsNullShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> new CassandraDriverHealthIndicator(null));
assertThatIllegalArgumentException().isThrownBy(() -> new CassandraDriverHealthIndicator(null))
.withMessage("'session' must not be null");
}
@Test

View File

@ -51,8 +51,10 @@ import static org.mockito.Mockito.mock;
class CassandraDriverReactiveHealthIndicatorTests {
@Test
@SuppressWarnings("NullAway") // Test null check
void createWhenCqlSessionIsNullShouldThrowException() {
assertThatIllegalArgumentException().isThrownBy(() -> new CassandraDriverReactiveHealthIndicator(null));
assertThatIllegalArgumentException().isThrownBy(() -> new CassandraDriverReactiveHealthIndicator(null))
.withMessage("'session' must not be null");
}
@Test