@Test
 public void testResetPassword()
     throws AccountManagerException, PasswordResetException, PasswordCreationException,
         PasswordActivationException {
   String activationKey = accountManager.createPassword(EMAIL_ADDRESS, VALID_PASSWORD);
   accountManager.activatePassword(EMAIL_ADDRESS, activationKey);
   accountManager.createAccount(EMAIL_ADDRESS, EMAIL_ADDRESS.getAddress(), "engineer");
   assertTrue(passwordStoreClient.authenticate(EMAIL_ADDRESS, VALID_PASSWORD));
   Password newPassword = accountManager.resetPassword(EMAIL_ADDRESS);
   assertTrue(passwordStoreClient.authenticate(EMAIL_ADDRESS, newPassword));
 }
 @Test
 public void testChangePassword()
     throws AccountManagerException, PasswordChangeException, PasswordCreationException,
         PasswordActivationException {
   String activationKey = accountManager.createPassword(EMAIL_ADDRESS, VALID_PASSWORD);
   accountManager.activatePassword(EMAIL_ADDRESS, activationKey);
   accountManager.createAccount(EMAIL_ADDRESS, EMAIL_ADDRESS.getAddress(), "engineer");
   assertTrue(passwordStoreClient.authenticate(EMAIL_ADDRESS, VALID_PASSWORD));
   String newPassword = VALID_PASSWORD.getPassword() + "New!";
   assertTrue(
       accountManager.changePassword(EMAIL_ADDRESS, VALID_PASSWORD, new Password(newPassword)));
   assertTrue(passwordStoreClient.authenticate(EMAIL_ADDRESS, new Password(newPassword)));
 }
 @Test
 public void testAuthenticateWrongPassword()
     throws AccountManagerException, PasswordCreationException, PasswordActivationException {
   String activationKey = accountManager.createPassword(EMAIL_ADDRESS, VALID_PASSWORD);
   accountManager.activatePassword(EMAIL_ADDRESS, activationKey);
   accountManager.createAccount(EMAIL_ADDRESS, EMAIL_ADDRESS.getAddress(), "engineer");
   assertFalse(
       passwordStoreClient.authenticate(
           EMAIL_ADDRESS, new Password(VALID_PASSWORD.getPassword() + "Wrong!")));
 }
 @Test(expected = PasswordChangeException.class)
 public void testChangePasswordTooWeakPassword()
     throws AccountManagerException, PasswordChangeException, PasswordCreationException,
         PasswordActivationException {
   String activationKey = accountManager.createPassword(EMAIL_ADDRESS, VALID_PASSWORD);
   accountManager.activatePassword(EMAIL_ADDRESS, activationKey);
   accountManager.createAccount(EMAIL_ADDRESS, EMAIL_ADDRESS.getAddress(), "engineer");
   assertTrue(passwordStoreClient.authenticate(EMAIL_ADDRESS, VALID_PASSWORD));
   accountManager.changePassword(EMAIL_ADDRESS, VALID_PASSWORD, TOO_WEAK_PASSWORD);
 }
 @After
 public void tearDown() {
   passwordStoreClient.close();
 }