use of org.hibernate.validator.internal.constraintvalidators.bv.number.bound.decimal.DecimalMinValidatorForNumber in project hibernate-validator by hibernate.
the class MinValidatorForNumberTest method testDecimalMin.
private void testDecimalMin(DecimalMin m, boolean inclusive) {
AbstractDecimalMinValidator constraint = new DecimalMinValidatorForNumber();
constraint.initialize(m);
testNumberValidator(constraint, inclusive, false);
constraint = new DecimalMinValidatorForBigDecimal();
constraint.initialize(m);
testValidatorBigDecimal(constraint, inclusive, false);
constraint = new DecimalMinValidatorForBigInteger();
constraint.initialize(m);
testValidatorBigInteger(constraint, inclusive, false);
constraint = new DecimalMinValidatorForByte();
constraint.initialize(m);
testValidatorByte(constraint, inclusive, false);
constraint = new DecimalMinValidatorForShort();
constraint.initialize(m);
testValidatorShort(constraint, inclusive, false);
constraint = new DecimalMinValidatorForInteger();
constraint.initialize(m);
testValidatorInteger(constraint, inclusive, false);
constraint = new DecimalMinValidatorForLong();
constraint.initialize(m);
testValidatorLong(constraint, inclusive, false);
constraint = new DecimalMinValidatorForFloat();
constraint.initialize(m);
testValidatorFloat(constraint, inclusive, false);
constraint = new DecimalMinValidatorForDouble();
constraint.initialize(m);
testValidatorDouble(constraint, inclusive, false);
}
use of org.hibernate.validator.internal.constraintvalidators.bv.number.bound.decimal.DecimalMinValidatorForNumber in project hibernate-validator by hibernate.
the class MinValidatorForNumberTest method testInitializeDecimalMinWithInvalidValue.
@Test(expectedExceptions = IllegalArgumentException.class)
public void testInitializeDecimalMinWithInvalidValue() {
ConstraintAnnotationDescriptor.Builder<DecimalMin> descriptorBuilder = new ConstraintAnnotationDescriptor.Builder<>(DecimalMin.class);
descriptorBuilder.setAttribute("value", "foobar");
descriptorBuilder.setMessage("{validator.min}");
DecimalMin m = descriptorBuilder.build().getAnnotation();
DecimalMinValidatorForNumber constraint = new DecimalMinValidatorForNumber();
constraint.initialize(m);
}
use of org.hibernate.validator.internal.constraintvalidators.bv.number.bound.decimal.DecimalMinValidatorForNumber in project hibernate-validator by hibernate.
the class MinValidatorForStringTest method testInitializeDecimalMaxWithInvalidValue.
@Test
public void testInitializeDecimalMaxWithInvalidValue() {
ConstraintAnnotationDescriptor.Builder<DecimalMin> descriptorBuilder = new ConstraintAnnotationDescriptor.Builder<>(DecimalMin.class);
descriptorBuilder.setAttribute("value", "foobar");
descriptorBuilder.setMessage("{validator.min}");
DecimalMin m = descriptorBuilder.build().getAnnotation();
DecimalMinValidatorForNumber constraint = new DecimalMinValidatorForNumber();
try {
constraint.initialize(m);
fail();
} catch (IllegalArgumentException e) {
// success
}
}
Aggregations