Author: epbernard
Date: 2008-06-03 15:50:49 -0400 (Tue, 03 Jun 2008)
New Revision: 14729
Modified:
validator/trunk/src/test/org/hibernate/validator/test/validators/Car.java
validator/trunk/src/test/org/hibernate/validator/test/validators/DigitsTest.java
Log:
Add more test to DigitsValidator (testing strings)
Modified: validator/trunk/src/test/org/hibernate/validator/test/validators/Car.java
===================================================================
--- validator/trunk/src/test/org/hibernate/validator/test/validators/Car.java 2008-06-03
19:11:06 UTC (rev 14728)
+++ validator/trunk/src/test/org/hibernate/validator/test/validators/Car.java 2008-06-03
19:50:49 UTC (rev 14729)
@@ -24,5 +24,7 @@
@Digits(integerDigits = 1, fractionalDigits = 2)
public BigDecimal length;
@Digits(integerDigits = 2, fractionalDigits = 1)
- public Double gallons;
+ public Double gallons;
+ @Digits(integerDigits = 2, fractionalDigits = 1)
+ public String mpg;
}
Modified:
validator/trunk/src/test/org/hibernate/validator/test/validators/DigitsTest.java
===================================================================
---
validator/trunk/src/test/org/hibernate/validator/test/validators/DigitsTest.java 2008-06-03
19:11:06 UTC (rev 14728)
+++
validator/trunk/src/test/org/hibernate/validator/test/validators/DigitsTest.java 2008-06-03
19:50:49 UTC (rev 14729)
@@ -24,13 +24,14 @@
car.insurances = new String[] { "random" };
car.length = new BigDecimal(10.2);
car.gallons = 100.3;
+ car.mpg = "EFG";
ClassValidator<Car> classValidator = new ClassValidator<Car>( Car.class );
InvalidValue[] invalidValues = classValidator.getInvalidValues( car );
- assertEquals( 2, invalidValues.length );
+ assertEquals( 3, invalidValues.length );
car.length = new BigDecimal(1.223); //more than 2
car.gallons = 10.300; //1 digit really so not invalid
invalidValues = classValidator.getInvalidValues( car );
- assertEquals( 1, invalidValues.length );
+ assertEquals( 2, invalidValues.length );
}
public void testApply() throws Exception {