@Override
    public Optional<String> validate(String password) {
        return password.matches(DIGIT_REGEX)
                ? Optional.empty()
                : Optional.of(DIGIT_REASONING);
    }
@Test
    public void testValidateFailure() {
        Optional<String> result = digitValidator.validate("Password");
        Assert.assertTrue(result.isPresent());
        Assert.assertEquals(result.get(), "must contain at least one digit between 0 and 9");
    }