@Test public void containsExlamationMarkIsNotValid() { ValidationResult userIdValidationResult = userIdValidation.validate("xxxab!d"); assertFalse("User id backslash forbidden, but accepted?!?", userIdValidationResult.isValid()); }
@Override protected void validate(ValidationContext<String> context) { validateNotNull(context); if (context.isInValid()) { return; } validateNoUpperCaseCharacters(context); validateSameLengthWhenTrimmed(context); validateLength(context); validateOnlyAlphabeticDigitOrAllowedParts(context, '-', '_'); }
UserIdValidationImpl extends AbstractSimpleStringValidation implements UserIdValidation { @Override protected void validate(ValidationContext<String> context) { validateNotNull(context); if (context.isInValid()) { return; } validateNoUpperCaseCharacters(context); validateSameLengthWhenTrimmed(context); validateLength(context); validateOnlyAlphabeticDigitOrAllowedParts(context, '-', '_'); } }
UserIdValidationImpl extends AbstractSimpleStringValidation implements UserIdValidation { @Override protected void validate(ValidationContext<String> context) { validateNotNull(context); if (context.isInValid()) { return; } validateNoUpperCaseCharacters(context); validateSameLengthWhenTrimmed(context); validateLength(context); validateOnlyAlphabeticDigitOrAllowedParts(context, '-', '_'); }  }
UserIdValidationImpl extends AbstractSimpleStringValidation implements UserIdValidation { @Override protected void validate(ValidationContext<String> context) { validateNotNull(context); if (context.isInValid()) { return; } validateNoUpperCaseCharacters(context); validateSameLengthWhenTrimmed(context); validateLength(context); validateOnlyAlphabeticDigitOrAllowedParts(context, '-', '_'); }   }
UserIdValidationImpl extends AbstractSimpleStringValidation implements UserIdValidation { @Override protected void validate(ValidationContext<String> context) { validateNotNull(context); if (context.isInValid()) { return; } validateNoUpperCaseCharacters(context); validateSameLengthWhenTrimmed(context); validateLength(context); validateOnlyAlphabeticDigitOrAllowedParts(context, '-', '_'); }   static final int USERNAME_LENGTH_MIN; static final int USERNAME_LENGTH_MAX; }