Add nullability annotations to tests in module/spring-boot-data-cassandra
See gh-47263
This commit is contained in:
parent
f5d6bea934
commit
4a62872d63
|
@ -45,3 +45,11 @@ dependencies {
|
|||
|
||||
testRuntimeOnly("ch.qos.logback:logback-classic")
|
||||
}
|
||||
|
||||
tasks.named("compileTestJava") {
|
||||
options.nullability.checking = "tests"
|
||||
}
|
||||
|
||||
tasks.named("compileDockerTestJava") {
|
||||
options.nullability.checking = "tests"
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.springframework.boot.data.cassandra.autoconfigure;
|
|||
import java.util.Collections;
|
||||
|
||||
import com.datastax.oss.driver.api.core.CqlSession;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
|
@ -144,7 +145,7 @@ class DataCassandraAutoConfigurationTests {
|
|||
static class MyConverter implements Converter<Person, String> {
|
||||
|
||||
@Override
|
||||
public String convert(Person o) {
|
||||
public @Nullable String convert(Person o) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,9 @@ class DataCassandraReactiveRepositoriesAutoConfigurationTests {
|
|||
|
||||
private ManagedTypes getManagedTypes(ApplicationContext context) {
|
||||
CassandraMappingContext mappingContext = context.getBean(CassandraMappingContext.class);
|
||||
return (ManagedTypes) ReflectionTestUtils.getField(mappingContext, "managedTypes");
|
||||
Object field = ReflectionTestUtils.getField(mappingContext, "managedTypes");
|
||||
assertThat(field).isNotNull();
|
||||
return (ManagedTypes) field;
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
|
|
|
@ -91,7 +91,9 @@ class DataCassandraRepositoriesAutoConfigurationTests {
|
|||
|
||||
private ManagedTypes getManagedTypes(AssertableApplicationContext context) {
|
||||
CassandraMappingContext mappingContext = context.getBean(CassandraMappingContext.class);
|
||||
return (ManagedTypes) ReflectionTestUtils.getField(mappingContext, "managedTypes");
|
||||
Object field = ReflectionTestUtils.getField(mappingContext, "managedTypes");
|
||||
assertThat(field).isNotNull();
|
||||
return (ManagedTypes) field;
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
|
|
Loading…
Reference in New Issue