Browse Source

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

See gh-47263
pull/47637/head
Moritz Halbritter 2 months ago
parent
commit
d849c884e4
  1. 4
      module/spring-boot-thymeleaf/build.gradle
  2. 1
      module/spring-boot-thymeleaf/src/test/java/org/springframework/boot/thymeleaf/autoconfigure/ThymeleafServletAutoConfigurationTests.java

4
module/spring-boot-thymeleaf/build.gradle

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

1
module/spring-boot-thymeleaf/src/test/java/org/springframework/boot/thymeleaf/autoconfigure/ThymeleafServletAutoConfigurationTests.java

@ -206,6 +206,7 @@ class ThymeleafServletAutoConfigurationTests { @@ -206,6 +206,7 @@ class ThymeleafServletAutoConfigurationTests {
this.contextRunner.run((context) -> {
ThymeleafView view = (ThymeleafView) context.getBean(ThymeleafViewResolver.class)
.resolveViewName("view", Locale.UK);
assertThat(view).isNotNull();
MockHttpServletResponse response = new MockHttpServletResponse();
MockHttpServletRequest request = new MockHttpServletRequest(context.getBean(ServletContext.class));
request.setAttribute(RequestContext.WEB_APPLICATION_CONTEXT_ATTRIBUTE, context);

Loading…
Cancel
Save