Browse Source

implement check for minimum password length

feature-password-validator
binsky 3 years ago
parent
commit
1a037c1927
  1. 3
      src/main/java/PasswordValidator.java
  2. 5
      src/test/java/PasswordValidatorTest.java

3
src/main/java/PasswordValidator.java

@ -1,6 +1,7 @@
public class PasswordValidator { public class PasswordValidator {
int minLength = 6;
public boolean validate(String password) { public boolean validate(String password) {
return false;
return password.length() >= minLength;
} }
} }

5
src/test/java/PasswordValidatorTest.java

@ -8,5 +8,8 @@ class PasswordValidatorTest {
void validate() { void validate() {
PasswordValidator passwordValidator = new PasswordValidator(); PasswordValidator passwordValidator = new PasswordValidator();
assertFalse(passwordValidator.validate("")); assertFalse(passwordValidator.validate(""));
// test minimum password length
assertTrue(passwordValidator.validate("abcdef"));
} }
}
}
Loading…
Cancel
Save