Calls {@link #addError(String)} with a message that indicates
that an array has the wrong number of elements

@param expectedSize
@param actualSize
@throws ValidationException
175275
public void addBadArraySizeError(final int expectedSize, final int actualSize) throws ValidationException
    {
        addError(StringFormatter.format(MessageConstants.MESSAGES.invalidArraySize(), expectedSize, actualSize));
    }
1117875
@Override
	public void compareJSONArray(String prefix, JSONArray expected,
			JSONArray actual, JSONCompareResult result) throws JSONException {
		String arrayPrefix = prefix + "[]";
		if (expected.length() < 1 || expected.length() > 2) {
			result.fail(MessageFormat
					.format("{0}: invalid expectation: expected array should contain either 1 or 2 elements but contains {1} elements",
							arrayPrefix, expected.length()));
			return;
		}
		if (!(expected.get(0) instanceof Number)) {
			result.fail(MessageFormat
					.format("{0}: invalid expectation: {1}expected array size ''{2}'' not a number",
							arrayPrefix, (expected.length() == 1? "": "minimum "), expected.get(0)));
			return;
		}
		if ((expected.length() == 2 && !(expected.get(1) instanceof Number))) {
			result.fail(MessageFormat
					.format("{0}: invalid expectation: maximum expected array size ''{1}'' not a number",
							arrayPrefix, expected.get(1)));
			return;
		}
		int minExpectedLength = expected.getInt(0);
		if (minExpectedLength < 0) {
			result.fail(MessageFormat
					.format("{0}: invalid expectation: minimum expected array size ''{1}'' negative",
							arrayPrefix, minExpectedLength));
			return;
		}
		int maxExpectedLength = expected.length() == 2 ? expected.getInt(1)
				: minExpectedLength;
		if (maxExpectedLength < minExpectedLength) {
			result.fail(MessageFormat
					.format("{0}: invalid expectation: maximum expected array size ''{1}'' less than minimum expected array size ''{2}''",
							arrayPrefix, maxExpectedLength, minExpectedLength));
			return;
		}
		if (actual.length() < minExpectedLength
				|| actual.length() > maxExpectedLength) {
			result.fail(
					arrayPrefix,
					MessageFormat.format(
							"array size of {0}{1} elements",
							minExpectedLength,
							(expected.length() == 2 ? (" to " + maxExpectedLength)
									: "")),
					MessageFormat.format("{0} elements",
							actual.length()));
		}
	}
1147555
final void addError( ParsedElement parsedElement, ResourceKey errorMsg )
  {
    verify( parsedElement, false, errorMsg, EMPTY_ARRAY );
  }
427412
function (actual, message) {
        YUITest.Assert._increment();
        if (actual.length > 0){
            YUITest.Assert.fail(YUITest.Assert._formatMessage(message, "Array should be empty."));
        }
    }
276836
function AssertionError(actual, expected, phrase, base) {
  this.name = 'AssertionError';
  this.actual = actual;
  this.expected = expected;
  this.message = 'expected ' + objectDisplay(actual) + ' ' +
      phrase + ' ' +
    objectDisplay(expected);

  if (typeof actual === 'object' || typeof expected === 'object') {
    this.showDiff = true;
  }

  Error.captureStackTrace(this, base);
}
411726
public static String validate(String value, int expected) {
        if (value.length() != expected) {
            throw new InvalidLengthException(value, expected);
        }
        return value;
    }
197053
private function addError($errorCode, $valid = true)
    {
        $this->isValid = $valid;
        $this->errors[] = $errorCode;

        return $this;
    }
156666
public static ValidationException error(String messageKey, 
			Object... params) {
		return new ValidationException(
				ValidationMessage.error(messageKey, params));		
	}
535310
@Override
	protected void validateComponent(final List<Diagnostic> diags) {
		if (isValidNumber()) {
			super.validateComponent(diags);
			validateNumber(diags);
		} else {
			diags.add(createErrorDiagnostic(InternalMessages.DEFAULT_VALIDATION_ERROR_INVALID, this));
		}
	}
1228668
private void addError(IValidationContext context, ConstraintViolation violation, JsonPointer pointer) {

		// extract the error code, if any
		final Class<? extends Annotation> annotationType = violation.getConstraintDescriptor().getAnnotation().annotationType();
		final IErrorCode validationCode = constraintConverter.getErrorCode(annotationType);
		final IErrorLocationType validationType = constraintConverter.getErrorLocationType(annotationType);

		// add the error to the validation context
		context.addError(pointer.toString(), validationType, validationCode, violation.getMessage());
	}
1220072
public static BigDecimal validateBigDecimalValue(BigDecimal newValue, int expectedPrecision,int expectedScale)
    {
        if(newValue != null)
        {
            int scale = newValue.scale();
            int precision = newValue.precision();

            if(isAbsBetweenZeroAndOne(newValue))
            {
                newValue = newValue.setScale(expectedScale, java.math.RoundingMode.HALF_UP);
            }
            else
            {
                int integerPart = precision - scale;
                int expectedIntegerPart = expectedPrecision - expectedScale;

                if (integerPart > expectedIntegerPart)
                {
                    throw new MithraBusinessException("Invalid BigDecimal: " + newValue.toPlainString() + ". Expected a BigDecimal with (precision, scale) of: (" + expectedPrecision + "," + expectedScale + ")");
                }
                if (scale != expectedScale || precision > expectedPrecision)
                {
                    scale = expectedScale;
                    newValue = newValue.setScale(scale, java.math.RoundingMode.HALF_UP);
                }
            }
        }
        return newValue;
    }
1206312
public void add(ValidationResult validation) {
    correct &= validation.correct;
    if (!validate) return;
    errors.addAll(validation.errors);
    warnings.addAll(validation.warnings);
  }
362298
@Override
    public SubsetValidation validate(SubsetSolution solution){
        // check size
        boolean validSize = solution.getNumSelectedIDs() >= getMinSubsetSize()
                                && solution.getNumSelectedIDs() <= getMaxSubsetSize();
        // combine with mandatory constraint validation
        if(getMandatoryConstraints().isEmpty()){
            // CASE 1: no mandatory constraints -- return constant validation object
            return validSize ? UNCONSTRAINED_VALID_SIZE : UNCONSTRAINED_INVALID_SIZE;
        } else {
            // CASE 2: mandatory constraint(s) -- wrap constraints validation in subset validation
            Validation constraintVal = super.validate(solution);
            return new SubsetValidation(validSize, constraintVal);
        }
    }
727027
public void addValidationError(String message) {
        messages.add(new UIMessageDTO(message, null, UIMessage.Severity.ERROR));
        valid = false;
        canExecute = false;
    }
391584
public void addMisMatch(String name, String expected, String actual) {
        result = "NOK";
        Mismatch mismatch = new Mismatch();
        mismatch.name = name;
        mismatch.expected = expected;
        mismatch.actual = actual;
        mismatches.add(mismatch);
    }
409387
public void setValidationErrors(com.google.api.ads.adwords.axis.v201809.cm.FeedItemAttributeError[] validationErrors) {
        this.validationErrors = validationErrors;
    }
665132
@Override
	protected void validateComponent(final List<Diagnostic> diags) {
		super.validateComponent(diags);

		String[] values = getValue();

		if (values != null) {
			int max = getMaxLength();
			int min = getMinLength();
			Pattern pattern = getComponentModel().pattern;

			for (String value : values) {
				boolean invalid = false;

				if (Util.empty(value)) {
					continue;
				}

				// Minimum Length
				if (min > 0 && value.length() < min) {
					diags.add(createErrorDiagnostic(
							InternalMessages.DEFAULT_VALIDATION_ERROR_MIN_LENGTH, this,
							String.valueOf(min)));
					invalid = true;
				}

				// Maximum Length
				if (max > 0 && value.length() > max) {
					diags.add(createErrorDiagnostic(
							InternalMessages.DEFAULT_VALIDATION_ERROR_MAX_LENGTH, this,
							String.valueOf(max)));
					invalid = true;
				}

				// Pattern
				if (pattern != null) {
					Matcher matcher = pattern.matcher(value);
					if (!matcher.matches()) {
						diags.add(createErrorDiagnostic(
								InternalMessages.DEFAULT_VALIDATION_ERROR_INVALID_PATTERN, this));
						invalid = true;
					}
				}

				// Only report the first invalid item
				if (invalid) {
					break;
				}
			}
		}
	}