public UserAccount authenticateUser(String username, String password) {
   for (UserAccount ua : userAccountList)
     if (ua.getUsername().equals(username) && ua.getPassword().equals(password)) {
       return ua;
     }
   return null;
 }
  public UserAccount authenticateUser(String userName, String password) {

    for (UserAccount account : userAccounts) {

      if (account.getUserName().equalsIgnoreCase(userName)
          && account.getPassword().equals(password)) {
        return account;
      }
    }
    return null;
  }
  @Test
  @UsingDataSet("users.json")
  @ShouldMatchDataSet("expected-users.json")
  public void should_change_user_password_using_json_data_sets() throws Exception {
    // given
    String expectedPassword = "******";
    UserAccount user = em.find(UserAccount.class, 2L);

    // when
    user.setPassword("LexLuthor");
    user = em.merge(user);

    // then
    assertThat(user.getPassword()).isEqualTo(expectedPassword);
  }
  @Test
  @ApplyScriptBefore("users.sql")
  @ShouldMatchDataSet("expected-users.yml")
  public void should_change_password_using_sql_to_seed_data() throws Exception {
    // given
    String expectedPassword = "******";
    UserAccount user = em.find(UserAccount.class, 2L);

    // when
    user.setPassword("LexLuthor");
    user = em.merge(user);

    // then
    assertThat(user.getPassword()).isEqualTo(expectedPassword);
  }
 private void revertToOldPassword() {
   UserAccount accountBeforeChange = AccountForm.findByUserName(username);
   password = accountBeforeChange.getPassword();
 }