BaseAuthFilter extends ModalityFilter { protected USER getAuthentifiedUser(HttpServletRequest request) throws ServletException { return authenticate(request); }  @Override void init(FilterConfig filterConfig); @Override void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain); @Override void destroy(); static final String REALM; static final String PROTECTED_RESOURCES; static final String PUBLIC_RESOURCES; }
@Test public void getAuthentifiedUser() throws Exception { recordConfig(); expect(request.getRequestURI()).andAnswer(eval("/some-uri")); expect(request.getParameter("Good-Login")).andAnswer(eval("Nestor")); replayAll(); authFilter = new AuthFilter(); authFilter.init(filterConfig); authFilter.getAuthentifiedUser(request); }