Authentication auth = new TestingAuthenticationToken(user, null);
AuthenticationException exception = new BadCredentialsException("Password doesn't match!");
exception.setAuthentication(auth);
RedirectStrategy redirectStrategy = mock(RedirectStrategy.class);
handler.setRedirectStrategy(redirectStrategy);
handler.setDefaultFailureUrl("/badlogin?login_error=1");
handler.setUsernameSessionAttribute("j_user_name");
HttpServletRequest request = new MockHttpServletRequest();