@Override
  public void doFilter(HttpRequest request, HttpResponse response, FilterChain chain) throws IOException {
    if (userSession.hasSession() && userSession.isLoggedIn() && userSession.shouldResetPassword()) {
      redirectTo(response, request.getContextPath() + RESET_PASSWORD_PATH);
    }

    chain.doFilter(request, response);
  }
@Test
  public void do_not_redirect_if_not_logged_in() throws Exception {
    when(session.isLoggedIn()).thenReturn(false);

    underTest.doFilter(request, response, chain);

    verify(response, never()).sendRedirect(any());
  }