use of org.cloudfoundry.identity.uaa.scim.exception.InvalidPasswordException in project uaa by cloudfoundry.
the class ResetPasswordAuthenticationFilterTest method error_during_password_reset_invalid_password_exception.
@Test
public void error_during_password_reset_invalid_password_exception() throws Exception {
reset(service);
InvalidPasswordException failed = new InvalidPasswordException("failed", HttpStatus.BAD_REQUEST);
when(service.resetPassword(any(ExpiringCode.class), anyString())).thenThrow(failed);
error_during_password_reset(failed.getClass());
verify(service, times(1)).resetPassword(any(ExpiringCode.class), eq(password));
}
use of org.cloudfoundry.identity.uaa.scim.exception.InvalidPasswordException in project uaa by cloudfoundry.
the class UaaPasswordPolicyValidatorTests method validatePassword.
private void validatePassword(String password, String... expectedErrors) {
ScimUser user = new ScimUser();
user.setOrigin(OriginKeys.UAA);
try {
validator.validate(password);
if (expectedErrors != null && expectedErrors.length > 0) {
fail();
}
} catch (InvalidPasswordException e) {
if (expectedErrors.length == 0) {
fail("Didn't expect InvalidPasswordException, but messages were " + e.getErrorMessages());
}
for (String expectedError : expectedErrors) {
assertTrue("Errors should contain:" + expectedError, e.getErrorMessages().contains(expectedError));
}
}
}
Aggregations