Skip to content

Commit cae3fb5

Browse files
committed
Add nullability annotations to tests in module/spring-boot-http-converter
See gh-47263
1 parent f175d13 commit cae3fb5

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

module/spring-boot-http-converter/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,7 @@ dependencies {
5050
testRuntimeOnly("org.springframework:spring-webflux")
5151
testRuntimeOnly("tools.jackson.dataformat:jackson-dataformat-cbor")
5252
}
53+
54+
tasks.named("compileTestJava") {
55+
options.nullability.checking = "tests"
56+
}

module/spring-boot-http-converter/src/test/java/org/springframework/boot/http/converter/autoconfigure/HttpMessageConvertersTests.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.List;
2222
import java.util.stream.Stream;
2323

24+
import org.jspecify.annotations.Nullable;
2425
import org.junit.jupiter.api.Test;
2526

2627
import org.springframework.http.converter.ByteArrayHttpMessageConverter;
@@ -172,10 +173,12 @@ protected List<HttpMessageConverter<?>> postProcessPartConverters(
172173

173174
private List<HttpMessageConverter<?>> extractFormPartConverters(List<HttpMessageConverter<?>> converters) {
174175
AllEncompassingFormHttpMessageConverter formConverter = findFormConverter(converters);
176+
assertThat(formConverter).isNotNull();
175177
return formConverter.getPartConverters();
176178
}
177179

178-
private AllEncompassingFormHttpMessageConverter findFormConverter(Collection<HttpMessageConverter<?>> converters) {
180+
private @Nullable AllEncompassingFormHttpMessageConverter findFormConverter(
181+
Collection<HttpMessageConverter<?>> converters) {
179182
for (HttpMessageConverter<?> converter : converters) {
180183
if (converter instanceof AllEncompassingFormHttpMessageConverter allEncompassingConverter) {
181184
return allEncompassingConverter;

0 commit comments

Comments
 (0)