}
@Test
public void testHandleLogin() throws AuthenticationException {
MockHttpSession mockHttpSession = new MockHttpSession();
mockHttpSession.setAttribute(LoginController.REQUESTED_URL, "someUrl");
String view = this.loginController.handleLogin("john", "secret", mockHttpSession);
Account account = (Account) mockHttpSession.getAttribute(LoginController.ACCOUNT_ATTRIBUTE);
assertNotNull(account);
assertEquals("John", account.getFirstName());
assertEquals("Doe", account.getLastName());
assertNull(mockHttpSession.getAttribute(LoginController.REQUESTED_URL));
assertEquals("redirect:someUrl", view);
// Test the different view selection choices
mockHttpSession = new MockHttpSession();
view = this.loginController.handleLogin("john", "secret", mockHttpSession);
assertEquals("redirect:/index.htm", view);
mockHttpSession = new MockHttpSession();
mockHttpSession.setAttribute(LoginController.REQUESTED_URL, "abclogindef");
view = this.loginController.handleLogin("john", "secret", mockHttpSession);
assertEquals("redirect:/index.htm", view);
}