Add nullability annotations to tests in smoke-test/spring-boot-smoke-test-session-data-redis

See gh-47263
This commit is contained in:
Moritz Halbritter
2025-10-16 11:24:47 +02:00
parent ef754f55fc
commit a995c75891
2 changed files with 13 additions and 5 deletions
@@ -34,3 +34,11 @@ dependencies {
dockerTestImplementation("com.redis:testcontainers-redis")
dockerTestImplementation("org.testcontainers:junit-jupiter")
}
tasks.named("compileTestJava") {
options.nullability.checking = "tests"
}
tasks.named("compileDockerTestJava") {
options.nullability.checking = "tests"
}
@@ -72,20 +72,20 @@ class SampleSessionRedisApplicationTests {
ResponseEntity<Map<String, Object>> response = getSessions();
assertThat(response).isNotNull();
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
List<Map<String, Object>> sessions = (List<Map<String, Object>>) response.getBody().get("sessions");
Map<String, Object> body = response.getBody();
assertThat(body).isNotNull();
List<Map<String, Object>> sessions = (List<Map<String, Object>>) body.get("sessions");
assertThat(sessions).hasSize(1);
}
private String performLogin() {
private void performLogin() {
HttpHeaders headers = new HttpHeaders();
headers.setAccept(Collections.singletonList(MediaType.TEXT_HTML));
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
MultiValueMap<String, String> form = new LinkedMultiValueMap<>();
form.set("username", "user");
form.set("password", "password");
ResponseEntity<String> entity = this.restTemplate.exchange("/login", HttpMethod.POST,
new HttpEntity<>(form, headers), String.class);
return entity.getHeaders().getFirst("Set-Cookie");
this.restTemplate.exchange("/login", HttpMethod.POST, new HttpEntity<>(form, headers), String.class);
}
private RequestEntity<Object> getRequestEntity(URI uri) {