diff --git a/module/spring-boot-mustache/build.gradle b/module/spring-boot-mustache/build.gradle index 62b0ecb8af9..d3c79b70ae5 100644 --- a/module/spring-boot-mustache/build.gradle +++ b/module/spring-boot-mustache/build.gradle @@ -46,5 +46,11 @@ dependencies { testImplementation(testFixtures(project(":core:spring-boot-autoconfigure"))) testImplementation("io.projectreactor:reactor-test") + testCompileOnly("com.google.code.findbugs:jsr305") + testRuntimeOnly("ch.qos.logback:logback-classic") } + +tasks.named("compileTestJava") { + options.nullability.checking = "tests" +} diff --git a/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/autoconfigure/MustacheAutoConfigurationServletIntegrationTests.java b/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/autoconfigure/MustacheAutoConfigurationServletIntegrationTests.java index e33e4410d9f..46936b5419c 100644 --- a/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/autoconfigure/MustacheAutoConfigurationServletIntegrationTests.java +++ b/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/autoconfigure/MustacheAutoConfigurationServletIntegrationTests.java @@ -34,6 +34,7 @@ import org.springframework.boot.resttestclient.TestRestTemplate; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.tomcat.autoconfigure.servlet.TomcatServletWebServerAutoConfiguration; +import org.springframework.boot.web.server.WebServer; import org.springframework.boot.web.server.servlet.context.ServletWebServerApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -63,7 +64,9 @@ class MustacheAutoConfigurationServletIntegrationTests { @BeforeEach void init() { - this.port = this.context.getWebServer().getPort(); + WebServer webServer = this.context.getWebServer(); + assertThat(webServer).isNotNull(); + this.port = webServer.getPort(); } @Test diff --git a/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/reactive/view/MustacheViewResolverTests.java b/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/reactive/view/MustacheViewResolverTests.java index 6e177a633fa..86034bc5c23 100644 --- a/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/reactive/view/MustacheViewResolverTests.java +++ b/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/reactive/view/MustacheViewResolverTests.java @@ -17,6 +17,7 @@ package org.springframework.boot.mustache.reactive.view; import java.time.Duration; +import java.util.Locale; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -46,13 +47,13 @@ class MustacheViewResolverTests { @Test void resolveNonExistent() { - assertThat(this.resolver.resolveViewName("bar", null).block(Duration.ofSeconds(30))).isNull(); + assertThat(this.resolver.resolveViewName("bar", Locale.ROOT).block(Duration.ofSeconds(30))).isNull(); } @Test @WithResource(name = "template.html", content = "Hello {{World}}") void resolveExisting() { - assertThat(this.resolver.resolveViewName("template", null).block(Duration.ofSeconds(30))).isNotNull(); + assertThat(this.resolver.resolveViewName("template", Locale.ROOT).block(Duration.ofSeconds(30))).isNotNull(); } } diff --git a/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/servlet/view/MustacheViewResolverTests.java b/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/servlet/view/MustacheViewResolverTests.java index 61b25d0daa2..0483a8bd526 100644 --- a/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/servlet/view/MustacheViewResolverTests.java +++ b/module/spring-boot-mustache/src/test/java/org/springframework/boot/mustache/servlet/view/MustacheViewResolverTests.java @@ -16,6 +16,8 @@ package org.springframework.boot.mustache.servlet.view; +import java.util.Locale; + import org.assertj.core.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -49,20 +51,21 @@ class MustacheViewResolverTests { @Test void resolveNonExistent() throws Exception { - assertThat(this.resolver.resolveViewName("bar", null)).isNull(); + assertThat(this.resolver.resolveViewName("bar", Locale.ROOT)).isNull(); } @Test @WithResource(name = "template.html", content = "Hello {{World}}") void resolveExisting() throws Exception { - assertThat(this.resolver.resolveViewName("template", null)).isNotNull(); + assertThat(this.resolver.resolveViewName("template", Locale.ROOT)).isNotNull(); } @Test @WithResource(name = "template.html", content = "Hello {{World}}") void setsContentType() throws Exception { this.resolver.setContentType("application/octet-stream"); - View view = this.resolver.resolveViewName("template", null); + View view = this.resolver.resolveViewName("template", Locale.ROOT); + assertThat(view).isNotNull(); Assertions.assertThat(view.getContentType()).isEqualTo("application/octet-stream"); }