Browse Source

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

Closes gh-11202
pull/11213/merge
Stephane Nicoll 8 years ago
parent
commit
b6609ff392
  1. 6
      spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/session/SessionsEndpointTests.java
  2. 6
      spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/session/SessionsEndpointWebIntegrationTests.java

6
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/session/SessionsEndpointTests.java

@ -81,6 +81,12 @@ public class SessionsEndpointTests { @@ -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());

6
spring-boot-project/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/session/SessionsEndpointWebIntegrationTests.java

@ -82,8 +82,10 @@ public class SessionsEndpointWebIntegrationTests { @@ -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

Loading…
Cancel
Save