SessionManager implements SessionContext { public void header(String name) { if (name == null) throw new Error("name must not be null"); header = name; }  Session load(Request request, ActionLog actionLog); void save(RequestImpl request, Response response, ActionLog actionLog); void store(SessionStore store); void timeout(Duration timeout); void cookie(String name, String domain); void header(String name); @Override void invalidate(String key, String value);  }
@Test void header() { sessionManager.header("SessionId"); ActionLog actionLog = new ActionLog(null, null); String sessionId = UUID.randomUUID().toString(); store.save(sessionId, "localhost", Map.of("key", "value"), Set.of(), Duration.ofMinutes(30)); when(request.scheme()).thenReturn("https"); when(request.header("SessionId")).thenReturn(Optional.of(sessionId)); Session session = sessionManager.load(request, actionLog); assertThat(session).isNotNull(); assertThat(session.get("key")).isNotNull().hasValue("value"); assertThat(actionLog.context.get("session_hash")).isNotEmpty(); }