assertEquals(minimumLengthConstraint, error.getConstraint());
}
public void testVerifyMaximumLengthConstraint() {
final MutableCollectionType collectionType =
(MutableCollectionType) getMutableInhibitor();
final MutableMaximumLengthConstraint maximumLengthConstraint =
CONSTRAINT_FACTORY.createMaximumLengthConstraint();
maximumLengthConstraint.setLimit(2);
collectionType.setMaximumLengthConstraint(maximumLengthConstraint);
// check constraint with right value
final MutableCollectionValue collectionValue =
createCollectionValue(new String[]{"one", "two"});
Collection errors = collectionType.verify(collectionValue);
assertEquals(0, errors.size());
// check constraint violation
maximumLengthConstraint.setLimit(1);
collectionType.setMaximumLengthConstraint(maximumLengthConstraint);
errors = collectionType.verify(collectionValue);
assertEquals(1, errors.size());
final Iterator iter = errors.iterator();
VerificationError error = (VerificationError) iter.next();
assertEquals(VerificationError.TYPE_CONSTRAINT_VIOLATION,
error.getType());