@ -4,4 +4,12 @@ public class PasswordValidator {
public boolean validate(String password) {
return password.length() >= minLength;
}
public int getMinLength() {
return minLength;
public void setMinLength(int minLength) {
this.minLength = minLength;
@ -10,6 +10,9 @@ class PasswordValidatorTest {
assertFalse(passwordValidator.validate(""));
// test minimum password length
passwordValidator.setMinLength(6);
assertFalse(passwordValidator.validate("abcde"));
assertTrue(passwordValidator.validate("abcdef"));
assertTrue(passwordValidator.validate("abcdefg"));