|
@ -14,6 +14,7 @@ class PasswordValidatorTest { |
|
|
passwordValidator.setRequireUppercase(false); |
|
|
passwordValidator.setRequireUppercase(false); |
|
|
passwordValidator.setRequireLowercase(false); |
|
|
passwordValidator.setRequireLowercase(false); |
|
|
passwordValidator.setRequireDigit(false); |
|
|
passwordValidator.setRequireDigit(false); |
|
|
|
|
|
passwordValidator.setCheckPwned(false); |
|
|
assertFalse(passwordValidator.validate("abcde")); |
|
|
assertFalse(passwordValidator.validate("abcde")); |
|
|
assertTrue(passwordValidator.validate("abcdef")); |
|
|
assertTrue(passwordValidator.validate("abcdef")); |
|
|
assertTrue(passwordValidator.validate("abcdefg")); |
|
|
assertTrue(passwordValidator.validate("abcdefg")); |
|
@ -22,6 +23,7 @@ class PasswordValidatorTest { |
|
|
passwordValidator.setRequireUppercase(true); |
|
|
passwordValidator.setRequireUppercase(true); |
|
|
passwordValidator.setRequireLowercase(false); |
|
|
passwordValidator.setRequireLowercase(false); |
|
|
passwordValidator.setRequireDigit(false); |
|
|
passwordValidator.setRequireDigit(false); |
|
|
|
|
|
passwordValidator.setCheckPwned(false); |
|
|
assertFalse(passwordValidator.validate("abcdef")); |
|
|
assertFalse(passwordValidator.validate("abcdef")); |
|
|
assertTrue(passwordValidator.validate("abCdef")); |
|
|
assertTrue(passwordValidator.validate("abCdef")); |
|
|
assertTrue(passwordValidator.validate("ABCDEF")); |
|
|
assertTrue(passwordValidator.validate("ABCDEF")); |
|
@ -30,6 +32,7 @@ class PasswordValidatorTest { |
|
|
passwordValidator.setRequireUppercase(true); |
|
|
passwordValidator.setRequireUppercase(true); |
|
|
passwordValidator.setRequireLowercase(true); |
|
|
passwordValidator.setRequireLowercase(true); |
|
|
passwordValidator.setRequireDigit(false); |
|
|
passwordValidator.setRequireDigit(false); |
|
|
|
|
|
passwordValidator.setCheckPwned(false); |
|
|
assertFalse(passwordValidator.validate("abcdef")); |
|
|
assertFalse(passwordValidator.validate("abcdef")); |
|
|
assertTrue(passwordValidator.validate("abCdef")); |
|
|
assertTrue(passwordValidator.validate("abCdef")); |
|
|
assertFalse(passwordValidator.validate("ABCDEF")); |
|
|
assertFalse(passwordValidator.validate("ABCDEF")); |
|
@ -38,6 +41,7 @@ class PasswordValidatorTest { |
|
|
passwordValidator.setRequireUppercase(true); |
|
|
passwordValidator.setRequireUppercase(true); |
|
|
passwordValidator.setRequireLowercase(true); |
|
|
passwordValidator.setRequireLowercase(true); |
|
|
passwordValidator.setRequireDigit(true); |
|
|
passwordValidator.setRequireDigit(true); |
|
|
|
|
|
passwordValidator.setCheckPwned(false); |
|
|
assertFalse(passwordValidator.validate("8")); |
|
|
assertFalse(passwordValidator.validate("8")); |
|
|
assertFalse(passwordValidator.validate("12345678")); |
|
|
assertFalse(passwordValidator.validate("12345678")); |
|
|
assertFalse(passwordValidator.validate("abcdef")); |
|
|
assertFalse(passwordValidator.validate("abcdef")); |
|
@ -46,6 +50,15 @@ class PasswordValidatorTest { |
|
|
assertFalse(passwordValidator.validate("ABCDEF")); |
|
|
assertFalse(passwordValidator.validate("ABCDEF")); |
|
|
assertFalse(passwordValidator.validate("ABCDEF8")); |
|
|
assertFalse(passwordValidator.validate("ABCDEF8")); |
|
|
assertTrue(passwordValidator.validate("abCDE8F")); |
|
|
assertTrue(passwordValidator.validate("abCDE8F")); |
|
|
|
|
|
|
|
|
|
|
|
// test password pwned check |
|
|
|
|
|
passwordValidator.setRequireUppercase(true); |
|
|
|
|
|
passwordValidator.setRequireLowercase(true); |
|
|
|
|
|
passwordValidator.setRequireDigit(true); |
|
|
|
|
|
passwordValidator.setCheckPwned(true); |
|
|
|
|
|
assertFalse(passwordValidator.validate("8")); |
|
|
|
|
|
assertFalse(passwordValidator.validate("asdf12")); |
|
|
|
|
|
assertTrue(passwordValidator.validate("=phan0johB4aisae6Mie0jeip9Saejahc0iuvuth7ahv9uoni6o*_.+")); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Test |
|
|
@Test |
|
|