Polish "Fix NullPointer when requesting a session that does not exist"
Closes gh-11202
This commit is contained in:
@@ -81,6 +81,12 @@ public class SessionsEndpointTests {
|
||||
assertThat(result.isExpired()).isEqualTo(session.isExpired());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getSessionWithIdNotFound() {
|
||||
given(this.repository.findById("not-found")).willReturn(null);
|
||||
assertThat(this.endpoint.getSession("not-found")).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deleteSession() {
|
||||
this.endpoint.deleteSession(session.getId());
|
||||
|
||||
@@ -82,8 +82,10 @@ public class SessionsEndpointWebIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void sessionForIdNotFound() {
|
||||
client.get().uri((builder) -> builder.path("/actuator/sessions/some-session-id-that-does-not-exist")
|
||||
.build()).exchange().expectStatus().isNotFound();
|
||||
client.get()
|
||||
.uri((builder) -> builder.path(
|
||||
"/actuator/sessions/session-id-not-found").build())
|
||||
.exchange().expectStatus().isNotFound();
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
||||
Reference in New Issue
Block a user