@Test
  public void shouldOnUpdatePasswordIfErrorsReturnResetPasswordChangeForm() {
    PlayerProfile userProfile = setUpPlayerProfile();
    PasswordChangeRequest passwordChangeForm = setUpPasswordUpdate();
    passwordChangeForm =
        new PasswordChangeFormTestBuilder(passwordChangeForm).withConfirmNewPassword("bob").build();

    when(bindingResult.hasErrors()).thenReturn(true);
    underTest.updatedPassword(
        request, response, false, passwordChangeForm, bindingResult, modelMap);

    PasswordChangeRequest expectedPasswordChangeForm =
        new PasswordChangeFormTestBuilder(passwordChangeForm).build();
    expectedPasswordChangeForm.clear();

    assertEquals(expectedPasswordChangeForm, passwordChangeForm);
  }
  @Test
  public void shouldErrorIfCurrentPasswordDoesNotMatch() {
    final PasswordChangeRequest passwordChangeForm =
        new PasswordChangeFormTestBuilder()
            .withConfirmNewPassword(PasswordChangeFormTestBuilder.NEW_PASSWORD)
            .build();
    passwordChangeForm.setCurrentPassword("incorrectPassword");
    when(authenticationService.authenticateYazinoUser(
            "anEmail", passwordChangeForm.getCurrentPassword()))
        .thenReturn(new PlayerProfileAuthenticationResponse());
    when(playerProfileService.findLoginEmailByPlayerId(PLAYER_ID)).thenReturn("anEmail");

    getUnderTest().validate(passwordChangeForm, errors);

    verify(errors)
        .rejectValue(
            "currentPassword", ValidationTools.ERROR_CODE_NON_MATCHING, "incorrect password");
  }
 private void setupYazinoLogin(PasswordChangeRequest passwordChangeForm) {
   when(authenticationService.authenticateYazinoUser(
           "anEmail", passwordChangeForm.getCurrentPassword()))
       .thenReturn(new PlayerProfileAuthenticationResponse(PLAYER_ID));
   when(playerProfileService.findLoginEmailByPlayerId(PLAYER_ID)).thenReturn("anEmail");
 }