Browse Source

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

See gh-47263
pull/47387/head
Moritz Halbritter 3 months ago
parent
commit
b6950f8fb0
  1. 8
      module/spring-boot-cassandra/build.gradle
  2. 4
      module/spring-boot-cassandra/src/test/java/org/springframework/boot/cassandra/health/CassandraDriverHealthIndicatorTests.java
  3. 4
      module/spring-boot-cassandra/src/test/java/org/springframework/boot/cassandra/health/CassandraDriverReactiveHealthIndicatorTests.java

8
module/spring-boot-cassandra/build.gradle

@ -48,3 +48,11 @@ dependencies { @@ -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"
}

4
module/spring-boot-cassandra/src/test/java/org/springframework/boot/cassandra/health/CassandraDriverHealthIndicatorTests.java

@ -48,8 +48,10 @@ import static org.mockito.Mockito.mock; @@ -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

4
module/spring-boot-cassandra/src/test/java/org/springframework/boot/cassandra/health/CassandraDriverReactiveHealthIndicatorTests.java

@ -51,8 +51,10 @@ import static org.mockito.Mockito.mock; @@ -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

Loading…
Cancel
Save