SessionManager { @Nullable public String getCurrentSessionId() { @Nullable final HttpSession httpSession = getCurrentSession(); if (httpSession == null) { return null; } return getSessionId(httpSession); } SessionManager();   SessionManager(@Nonnull final HttpServletRequest httpServletRequest); @Nonnull String startWebSession(@Nonnull final Principal principal); @Nonnull String startAppSession(@Nonnull final Principal principal); void terminateSession(); @Nullable String getCurrentSessionId(); @Nullable static SecurityContext createSecurityContextForSession(@Nonnull final HttpServletRequest httpServletRequest); static final String AUTHENTICATION_SCHEME_USERNAME; static final String AUTHENTICATION_SCHEME_APPTOKEN; }
@Test public void testGetCurrentSessionIdNoAuthenticatedUser() { LOG.info("testGetCurrentSessionIdNoAuthenticatedUser"); Mockito.when(httpServletRequest.getSession(false)).thenReturn(httpSession); assertThat(impl.getCurrentSessionId(), is(REFERENCE_SESSION_ID)); verify(httpServletRequest).getSession(false); }
@Test public void testGetCurrentSessionIdNoCurrentSession() { LOG.info("testGetCurrentSessionIdNoCurrentSession"); Mockito.when(httpServletRequest.getSession(false)).thenReturn(null); assertThat(impl.getCurrentSessionId(), is(nullValue())); verify(httpServletRequest).getSession(false); }