@Test
public void testOnAuthenticationFailureShouldRedirectToLoginPage() throws Exception {
JCUser user = new JCUser("username", "email", "password");
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");