@Before
  public void setUp() throws Exception {

    processor = new ValidCharactersConstraintProcessor();

    dictionaryValidationResult = new DictionaryValidationResult();
    dictionaryValidationResult.setErrorLevel(ErrorLevel.NOCONSTRAINT);

    addressEntry = new BusinessObjectEntry();

    List<AttributeDefinition> attributes = new ArrayList<AttributeDefinition>();

    cityAlphaPatternConstraint = new AlphaPatternConstraint();
    cityAlphaPatternConstraint.setMessageKey("validate.dummykey");
    cityAlphaPatternConstraint.setValidationMessageParams(new ArrayList<String>());

    cityDefinition = new AttributeDefinition();
    cityDefinition.setName("city");
    cityDefinition.setValidCharactersConstraint(cityAlphaPatternConstraint);
    attributes.add(cityDefinition);

    street1AlphaPatternConstraint = new AlphaPatternConstraint();
    street1AlphaPatternConstraint.setMessageKey("validate.dummykey");
    street1AlphaPatternConstraint.setValidationMessageParams(new ArrayList<String>());
    street1AlphaPatternConstraint.setAllowWhitespace(true);

    street1Definition = new AttributeDefinition();
    street1Definition.setName("street1");
    street1Definition.setValidCharactersConstraint(street1AlphaPatternConstraint);
    attributes.add(street1Definition);

    addressEntry.setAttributes(attributes);
  }
  /**
   * @see
   *     org.kuali.rice.krad.service.DataDictionaryService#getCollectionElementLabel(java.lang.Class,
   *     java.lang.String)
   */
  public String getCollectionElementLabel(
      String entryName, String collectionName, Class dataObjectClass) {
    String elementLabel = "";

    CollectionDefinition collectionDefinition = getCollectionDefinition(entryName, collectionName);
    if (collectionDefinition != null) {
      elementLabel = collectionDefinition.getElementLabel();
      if (StringUtils.isEmpty(elementLabel)) {
        BusinessObjectEntry boe =
            getDataDictionary().getBusinessObjectEntry(dataObjectClass.getName());
        if (boe != null) {
          elementLabel = boe.getObjectLabel();
        }
      }
    }

    return elementLabel;
  }
  /**
   * Checks an account numbers exact length
   *
   * @param accountNumber
   * @param size to be returned
   * @return
   */
  protected boolean isValidAccountNumberLength(
      String accountNumber, AccountCreationStatusDTO accountCreationStatus) {

    boolean isValid = false;
    int fieldSize = -1;

    // grab account number length from DD and set size
    final org.kuali.rice.krad.datadictionary.BusinessObjectEntry entry =
        SpringContext.getBean(DataDictionaryService.class)
            .getDataDictionary()
            .getBusinessObjectEntry(Account.class.getName());
    AttributeDefinition attributeDefinition =
        entry.getAttributeDefinition(KFSPropertyConstants.ACCOUNT_NUMBER);

    if (ObjectUtils.isNotNull(attributeDefinition)) {
      final ValidationPattern validationPattern = attributeDefinition.getValidationPattern();

      if (ObjectUtils.isNotNull(validationPattern)
          && validationPattern instanceof AlphaNumericValidationPattern) {
        AlphaNumericValidationPattern alphaPattern =
            (AlphaNumericValidationPattern) validationPattern;
        fieldSize = alphaPattern.getExactLength();
      }
    }

    // skip if account number null
    if (ObjectUtils.isNotNull(accountNumber)) {

      // data dictionary defined size must equal length of incoming value
      if (fieldSize == accountNumber.length()) {
        isValid = true;
      }
    }

    if (isValid == false) {
      setFailStatus(
          accountCreationStatus,
          KcUtils.getErrorMessage(
              KcConstants.AccountCreationService.ERROR_KR_ALPHANUMERIC_VALIDATION_EXACT_LENGTH,
              new String[] {"account number", String.valueOf(fieldSize)}));
    }

    return isValid;
  }