/** @see {@link VisitAttributeTypeValidator#validate(Object,Errors)} */
  @Test
  @Verifies(
      value = "should fail validation if field lengths are not correct",
      method = "validate(Object,Errors)")
  public void validate_shouldFailValidationIfFieldLengthsAreNotCorrect() throws Exception {
    VisitAttributeType visitAttributeType = new VisitAttributeType();
    visitAttributeType.setName(
        "too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text");
    visitAttributeType.setMinOccurs(1);
    visitAttributeType.setDatatypeConfig("[a-z]+");
    visitAttributeType.setDatatypeClassname(
        "too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text");
    visitAttributeType.setDescription(new String(new char[66000]));
    visitAttributeType.setPreferredHandlerClassname(
        "too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text");
    visitAttributeType.setRetireReason(
        "too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text");

    Errors errors = new BindException(visitAttributeType, "visitAttributeType");
    new VisitAttributeTypeValidator().validate(visitAttributeType, errors);

    Assert.assertTrue(errors.hasFieldErrors("name"));
    Assert.assertTrue(errors.hasFieldErrors("description"));
    Assert.assertTrue(errors.hasFieldErrors("datatypeClassname"));
    Assert.assertTrue(errors.hasFieldErrors("preferredHandlerClassname"));
    Assert.assertTrue(errors.hasFieldErrors("retireReason"));
  }
  /**
   * @see {@link VisitAttributeTypeValidator#validate(Object,
   *     org.springframework.validation.Errors)}
   */
  @Test
  @Verifies(
      value = "should pass validation if field lengths are correct",
      method = "validate(Object,Errors)")
  public void validate_shouldPassValidationIfFieldLengthsAreCorrect() throws Exception {
    VisitAttributeType visitAttributeType = new VisitAttributeType();
    visitAttributeType.setName("name");
    visitAttributeType.setMinOccurs(1);
    visitAttributeType.setDatatypeConfig("[a-z]+");
    visitAttributeType.setDatatypeClassname(RegexValidatedTextDatatype.class.getName());
    visitAttributeType.setDescription("some text");
    visitAttributeType.setRetireReason("some text");

    Errors errors = new BindException(visitAttributeType, "visitAttributeType");
    new VisitAttributeTypeValidator().validate(visitAttributeType, errors);

    Assert.assertFalse(errors.hasErrors());
  }