Polish "Fix NullPointer when requesting a session that does not exist"

Closes gh-11202
This commit is contained in:
Stephane Nicoll
2017-11-30 10:05:30 +01:00
parent 35c6dc4e3b
commit b6609ff392
2 changed files with 10 additions and 2 deletions

View File

@@ -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());

View File

@@ -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