@Test public void loginSuccessfull() throws Exception { Mockito.when(manager.authenticate(request)).thenReturn(request); final SecurityContext securityContext = Mockito .mock(SecurityContext.class); SecurityContextHolder.setContext(securityContext); setCredentials(username, password); loginBean.login(null); assertEquals(loginBean.login(), AdministratorLoginBean.INDEX_PAGE); Mockito.verify(securityContext).setAuthentication(request); verifyLoginManager(); }
public String login() { return isSuccess ? INDEX_PAGE : LOGIN_PAGE; }
AdministratorLoginBean implements Serializable { public String login() { return isSuccess ? INDEX_PAGE : LOGIN_PAGE; } }
AdministratorLoginBean implements Serializable { public String login() { return isSuccess ? INDEX_PAGE : LOGIN_PAGE; }  }
AdministratorLoginBean implements Serializable { public String login() { return isSuccess ? INDEX_PAGE : LOGIN_PAGE; }  String login(); void login(final ActionEvent ae); void setAdminAuthManager(final AuthenticationManager adminAuthManager); String getUsername(); void setUsername(final String username); String getPassword(); void setPassword(final String password); }
AdministratorLoginBean implements Serializable { public String login() { return isSuccess ? INDEX_PAGE : LOGIN_PAGE; }  String login(); void login(final ActionEvent ae); void setAdminAuthManager(final AuthenticationManager adminAuthManager); String getUsername(); void setUsername(final String username); String getPassword(); void setPassword(final String password); static final String EMPTY_FIELD_MESSAGE; static final String INVALID_LOGIN_MESSAGE; }