@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://www.example.com");
  assertEquals("http://www.example.com", url);
  when(session.isValid()).thenReturn(Boolean.TRUE);
  when(session.getId()).thenReturn("1234");
  url = cookieSessionTracking.encodeUrl(request, "http://www.example.com");
  assertEquals("Session is valid, but URL stames the same", "http://www.example.com", url);
}