CookieSessionTracking extends BaseSessionTracking implements SessionTracking { @Override public void configure(SessionConfiguration conf) { super.configure(conf); httpOnly = Boolean.valueOf(conf.getAttribute(COOKIE_HTTP_ONLY_PARAMETER, "true")); secure = Boolean.valueOf(conf.getAttribute(SECURE_COOKIE_PARAMETER, "false")); secureOnlyOnSecuredRequest = Boolean.valueOf(conf.getAttribute(SECURE_COOKIE_ON_SECURED_REQUEST_PARAMETER, "false")); contextPath = conf.getAttribute(COOKIE_CONTEXT_PATH_PARAMETER, null); }  @Override IdAndSource retrieveId(RequestWithSession request); @Override void propagateSession(RequestWithSession request, Object response); @Override void configure(SessionConfiguration conf); @Override boolean isCookieTracking();  }
@Test public void testEncodeUrl() { SessionConfiguration sc = new SessionConfiguration(); sc.setSessionIdName("asession"); cookieSessionTracking.configure(sc); RequestWithSession request = mock(RequestWithSession.class, withSettings().extraInterfaces(HttpServletRequest.class)); RepositoryBackedSession session = mock(RepositoryBackedSession.class); when(request.getRepositoryBackedSession(false)).thenReturn(session); when(session.isValid()).thenReturn(Boolean.FALSE); String url = cookieSessionTracking.encodeUrl(request, "http: assertEquals("http: when(session.isValid()).thenReturn(Boolean.TRUE); when(session.getId()).thenReturn("1234"); url = cookieSessionTracking.encodeUrl(request, "http: assertEquals("Session is valid, but URL stames the same", "http: }