@SuppressWarnings("unchecked")
  @Test
  public void testDoFilterRedirectLogin() throws IOException, ServletException {
    req.setRequestURI("/admin/bla.jsp");
    me.doFilter(req, resp, chain);

    assertNull(chain.getLastRequest());
    assertNull(chain.getLastResponse());

    assertFalse(resp.wasRedirectSent());
    Map<String, MockRequestDispatcher> m = req.getRequestDispatcherMap();
    assertEquals("/login.jsp", m.get(m.keySet().iterator().next()).getPath());
  }
  @SuppressWarnings("unchecked")
  @Test
  public void testDoFilterRedirectDeny() throws IOException, ServletException {
    req.setRequestURI("/admin/bla.jsp");

    // getSession() returns null otherwise - violation of the spec
    req.setSession(new MockHttpSession());

    SessionToken tok = new SessionToken("login", 1234, false);
    SecManager.getInstance(ctx).setSessionToken(req, tok);

    me.doFilter(req, resp, chain);

    assertNull(chain.getLastRequest());
    assertNull(chain.getLastResponse());

    assertFalse(resp.wasRedirectSent());
    Map<String, MockRequestDispatcher> m = req.getRequestDispatcherMap();
    assertEquals("/deny.do", m.get(m.keySet().iterator().next()).getPath());
  }