### Question:
ExpiredSessionDeletingSessionManager extends ForwardingSessionManager { @Override public CompletableFuture<Session> get(String sessionId) { return super.get(sessionId).thenApply(session -> { if (session != null) { if (Instant.now().isBefore(session.expirationTime())) { return session; } delete(sessionId); } return null; }); } ExpiredSessionDeletingSessionManager(SessionManager delegate); @Override CompletableFuture<Session> get(String sessionId);  }### Answer:
@Test void shouldReturnNonNull() { final Session expiredAfterOneHour = createSession(Instant.now().plus(1, ChronoUnit.HOURS)); final SessionManager delegate = mock(SessionManager.class); when(delegate.get(any())).thenReturn(CompletableFuture.completedFuture(expiredAfterOneHour)); final ExpiredSessionDeletingSessionManager manager = new ExpiredSessionDeletingSessionManager(delegate); assertThat(manager.get("id").join()).isEqualTo(expiredAfterOneHour); }
@Test void shouldReturnNull() { final Session expiredSession = createSession(Instant.EPOCH); final SessionManager delegate = mock(SessionManager.class); when(delegate.get(any())).thenReturn(CompletableFuture.completedFuture(expiredSession)); final ExpiredSessionDeletingSessionManager manager = new ExpiredSessionDeletingSessionManager(delegate); assertThat(manager.get("id").join()).isNull(); }