### Question:
NullableNotBlankValidator implements ConstraintValidator<NullableNotBlank, String> { public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) { if (s == null) { return true; } return s.trim().length() > 0; }  @Override void initialize(NullableNotBlank annotation); boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext);  }### Answer:
@Test public void passwordConsistingOfOnlySpacesShouldBeNotValid() { boolean isValid = validator.isValid(" ", validatorContext); assertFalse(isValid, "If user enters password consisting of only spaces, then we assume that the password is incorrect."); }
@Test public void notEnteredPasswordShouldBeCorrectlyValidated() { boolean isValid = validator.isValid(null, validatorContext); assertTrue(isValid, "If user don't enters password, then we assume that the password not edited."); }
@Test public void normalPasswordShouldBeValid() { boolean isValid = validator.isValid("q1@3W", validatorContext); assertTrue(isValid, "Normal password should be valid."); }