mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-10-03 07:49:03 +00:00
Add nullability annotations to tests in smoke-test/spring-boot-smoke-test-web-secure-jdbc
See gh-47263
This commit is contained in:
@@ -31,3 +31,7 @@ dependencies {
|
||||
testImplementation(project(":starter:spring-boot-starter-webmvc-test"))
|
||||
testImplementation("org.apache.httpcomponents.client5:httpclient5")
|
||||
}
|
||||
|
||||
tasks.named("compileTestJava") {
|
||||
options.nullability.checking = "tests"
|
||||
}
|
||||
|
||||
+7
-2
@@ -16,6 +16,7 @@
|
||||
|
||||
package smoketest.web.secure.jdbc;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -61,7 +62,9 @@ class SampleWebSecureJdbcApplicationTests {
|
||||
ResponseEntity<String> entity = this.restTemplate.withRedirects(HttpRedirects.DONT_FOLLOW)
|
||||
.exchange("/", HttpMethod.GET, new HttpEntity<>(headers), String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.FOUND);
|
||||
assertThat(entity.getHeaders().getLocation().toString()).endsWith(this.port + "/login");
|
||||
URI location = entity.getHeaders().getLocation();
|
||||
assertThat(location).isNotNull();
|
||||
assertThat(location.toString()).endsWith(this.port + "/login");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -85,7 +88,9 @@ class SampleWebSecureJdbcApplicationTests {
|
||||
ResponseEntity<String> entity = this.restTemplate.withRedirects(HttpRedirects.DONT_FOLLOW)
|
||||
.exchange("/login", HttpMethod.POST, new HttpEntity<>(form, headers), String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.FOUND);
|
||||
assertThat(entity.getHeaders().getLocation().toString()).endsWith(this.port + "/");
|
||||
URI location = entity.getHeaders().getLocation();
|
||||
assertThat(location).isNotNull();
|
||||
assertThat(location.toString()).endsWith(this.port + "/");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user