@Test public void isValid() { ProjectNameBlacklistValidator validator = new ProjectNameBlacklistValidator(); assertTrue(validator.isValid(null, null)); assertTrue(validator.isValid(StringUtils.EMPTY, null)); assertTrue(validator.isValid("project", null)); assertFalse(validator.isValid("_project", null)); assertFalse(validator.isValid("create", null)); }
@Override public boolean isValid(String value, ConstraintValidatorContext context) { if (StringUtils.isBlank(value)) { return true; } return !Pattern.matches("^" + DocumentrConstants.PROJECT_NAMES_BLACKLIST_PATTERN + "$", value); }
ProjectNameBlacklistValidator implements ConstraintValidator<ProjectNameNotBlacklisted, String> { @Override public boolean isValid(String value, ConstraintValidatorContext context) { if (StringUtils.isBlank(value)) { return true; } return !Pattern.matches("^" + DocumentrConstants.PROJECT_NAMES_BLACKLIST_PATTERN + "$", value); } }
ProjectNameBlacklistValidator implements ConstraintValidator<ProjectNameNotBlacklisted, String> { @Override public boolean isValid(String value, ConstraintValidatorContext context) { if (StringUtils.isBlank(value)) { return true; } return !Pattern.matches("^" + DocumentrConstants.PROJECT_NAMES_BLACKLIST_PATTERN + "$", value); }  }
ProjectNameBlacklistValidator implements ConstraintValidator<ProjectNameNotBlacklisted, String> { @Override public boolean isValid(String value, ConstraintValidatorContext context) { if (StringUtils.isBlank(value)) { return true; } return !Pattern.matches("^" + DocumentrConstants.PROJECT_NAMES_BLACKLIST_PATTERN + "$", value); }  @Override void initialize(ProjectNameNotBlacklisted annotation); @Override boolean isValid(String value, ConstraintValidatorContext context); }
ProjectNameBlacklistValidator implements ConstraintValidator<ProjectNameNotBlacklisted, String> { @Override public boolean isValid(String value, ConstraintValidatorContext context) { if (StringUtils.isBlank(value)) { return true; } return !Pattern.matches("^" + DocumentrConstants.PROJECT_NAMES_BLACKLIST_PATTERN + "$", value); }  @Override void initialize(ProjectNameNotBlacklisted annotation); @Override boolean isValid(String value, ConstraintValidatorContext context);  }