use of org.orcid.frontend.web.forms.ChangePasswordForm in project ORCID-Source by ORCID.
the class ChangePasswordFormValidatorTest method testPasswordMissingNumberInvalid.
@Test
public void testPasswordMissingNumberInvalid() {
ChangePasswordForm form = new ChangePasswordForm();
form.setOldPassword("£$$$$$$r");
Set<ConstraintViolation<ChangePasswordForm>> violations = validator.validate(form);
Map<String, String> allErrorValues = retrieveErrorKeyAndMessage(violations);
String password = allErrorValues.get("oldPassword");
assertEquals("Passwords must be 8 or more characters and contain at least 1 number and at least 1 alpha character or symbol", password);
//add in a number
form.setOldPassword("£$$$$$r1");
violations = validator.validate(form);
allErrorValues = retrieveErrorKeyAndMessage(violations);
password = allErrorValues.get("oldPassword");
assertNull(password);
}
Aggregations