|
|
@ -15,6 +15,7 @@ class PasswordValidatorTest { |
|
|
|
passwordValidator.setRequireLowercase(false); |
|
|
|
passwordValidator.setRequireDigit(false); |
|
|
|
passwordValidator.setCheckPwned(false); |
|
|
|
passwordValidator.setRequireSpecialChar(false); |
|
|
|
assertFalse(passwordValidator.validate("abcde")); |
|
|
|
assertTrue(passwordValidator.validate("abcdef")); |
|
|
|
assertTrue(passwordValidator.validate("abcdefg")); |
|
|
@ -24,6 +25,7 @@ class PasswordValidatorTest { |
|
|
|
passwordValidator.setRequireLowercase(false); |
|
|
|
passwordValidator.setRequireDigit(false); |
|
|
|
passwordValidator.setCheckPwned(false); |
|
|
|
passwordValidator.setRequireSpecialChar(false); |
|
|
|
assertFalse(passwordValidator.validate("abcdef")); |
|
|
|
assertTrue(passwordValidator.validate("abCdef")); |
|
|
|
assertTrue(passwordValidator.validate("ABCDEF")); |
|
|
@ -33,6 +35,7 @@ class PasswordValidatorTest { |
|
|
|
passwordValidator.setRequireLowercase(true); |
|
|
|
passwordValidator.setRequireDigit(false); |
|
|
|
passwordValidator.setCheckPwned(false); |
|
|
|
passwordValidator.setRequireSpecialChar(false); |
|
|
|
assertFalse(passwordValidator.validate("abcdef")); |
|
|
|
assertTrue(passwordValidator.validate("abCdef")); |
|
|
|
assertFalse(passwordValidator.validate("ABCDEF")); |
|
|
@ -42,6 +45,7 @@ class PasswordValidatorTest { |
|
|
|
passwordValidator.setRequireLowercase(true); |
|
|
|
passwordValidator.setRequireDigit(true); |
|
|
|
passwordValidator.setCheckPwned(false); |
|
|
|
passwordValidator.setRequireSpecialChar(false); |
|
|
|
assertFalse(passwordValidator.validate("8")); |
|
|
|
assertFalse(passwordValidator.validate("12345678")); |
|
|
|
assertFalse(passwordValidator.validate("abcdef")); |
|
|
@ -51,6 +55,17 @@ class PasswordValidatorTest { |
|
|
|
assertFalse(passwordValidator.validate("ABCDEF8")); |
|
|
|
assertTrue(passwordValidator.validate("abCDE8F")); |
|
|
|
|
|
|
|
// test special chars requirement |
|
|
|
passwordValidator.setRequireUppercase(true); |
|
|
|
passwordValidator.setRequireLowercase(true); |
|
|
|
passwordValidator.setRequireDigit(true); |
|
|
|
passwordValidator.setCheckPwned(false); |
|
|
|
passwordValidator.setRequireSpecialChar(true); |
|
|
|
assertFalse(passwordValidator.validate("*")); |
|
|
|
assertFalse(passwordValidator.validate("abCDE8F")); |
|
|
|
assertTrue(passwordValidator.validate("abCDE8_F")); |
|
|
|
assertTrue(passwordValidator.validate("abCDE*/8_F")); |
|
|
|
|
|
|
|
// test password pwned check |
|
|
|
passwordValidator.setRequireUppercase(true); |
|
|
|
passwordValidator.setRequireLowercase(true); |
|
|
|