@Test(expectedExceptions = InvalidPasswordException.class) public void requiredFailure() throws LoginException { whenLoginThrowInvalidPasswordException(requiredDelegate); whenLoginReturnTrue(requisiteDelegate, optionalDelegate); whenLoginReturnFalse(sufficientDelegate); whenAbortReturnTrue(requiredDelegate, requisiteDelegate, sufficientDelegate, optionalDelegate); try { context.login(); } finally { verifyInitialize(requiredDelegate, requisiteDelegate, sufficientDelegate, optionalDelegate); verifyLogin(requiredDelegate, requisiteDelegate, sufficientDelegate, optionalDelegate); verifyAbort(requiredDelegate, requisiteDelegate, sufficientDelegate, optionalDelegate); verifyNoMoreInteractions(requiredDelegate, requisiteDelegate, sufficientDelegate, optionalDelegate); } }
public void login() throws LoginException { loginSucceeded = false; if (subject == null) { subject = new Subject(); } try { invoke(LOGIN_METHOD); invoke(COMMIT_METHOD); loginSucceeded = true; } catch (LoginException le) { try { invoke(ABORT_METHOD); } catch (LoginException le2) { throw le; } throw le; } }
LoginContext { public void login() throws LoginException { loginSucceeded = false; if (subject == null) { subject = new Subject(); } try { invoke(LOGIN_METHOD); invoke(COMMIT_METHOD); loginSucceeded = true; } catch (LoginException le) { try { invoke(ABORT_METHOD); } catch (LoginException le2) { throw le; } throw le; } } }
LoginContext { public void login() throws LoginException { loginSucceeded = false; if (subject == null) { subject = new Subject(); } try { invoke(LOGIN_METHOD); invoke(COMMIT_METHOD); loginSucceeded = true; } catch (LoginException le) { try { invoke(ABORT_METHOD); } catch (LoginException le2) { throw le; } throw le; } } LoginContext(AppConfigurationEntry[] entries, 
        CallbackHandler callbackHandler);  LoginContext(AppConfigurationEntry[] entries, Subject subject,
                        CallbackHandler callbackHandler); }
LoginContext { public void login() throws LoginException { loginSucceeded = false; if (subject == null) { subject = new Subject(); } try { invoke(LOGIN_METHOD); invoke(COMMIT_METHOD); loginSucceeded = true; } catch (LoginException le) { try { invoke(ABORT_METHOD); } catch (LoginException le2) { throw le; } throw le; } } LoginContext(AppConfigurationEntry[] entries, 
        CallbackHandler callbackHandler);  LoginContext(AppConfigurationEntry[] entries, Subject subject,
                        CallbackHandler callbackHandler); void login(); void logout(); Subject getSubject(); }
LoginContext { public void login() throws LoginException { loginSucceeded = false; if (subject == null) { subject = new Subject(); } try { invoke(LOGIN_METHOD); invoke(COMMIT_METHOD); loginSucceeded = true; } catch (LoginException le) { try { invoke(ABORT_METHOD); } catch (LoginException le2) { throw le; } throw le; } } LoginContext(AppConfigurationEntry[] entries, 
        CallbackHandler callbackHandler);  LoginContext(AppConfigurationEntry[] entries, Subject subject,
                        CallbackHandler callbackHandler); void login(); void logout(); Subject getSubject();  }