Author: hardy.ferentschik
Date: 2009-03-02 04:47:52 -0500 (Mon, 02 Mar 2009)
New Revision: 16052
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/MaxValidatorForNumberTest.java
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/MinValidatorForNumberTest.java
Log:
added additional test attached to HV-122
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/MaxValidatorForNumberTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/MaxValidatorForNumberTest.java 2009-02-28
04:55:29 UTC (rev 16051)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/MaxValidatorForNumberTest.java 2009-03-02
09:47:52 UTC (rev 16052)
@@ -39,7 +39,7 @@
@BeforeClass
public static void init() {
- AnnotationDescriptor<Max> descriptor = new AnnotationDescriptor( Max.class );
+ AnnotationDescriptor<Max> descriptor = new AnnotationDescriptor<Max>(
Max.class );
descriptor.setValue( "value", 15l );
descriptor.setValue( "message", "{validator.max}" );
Max m = AnnotationFactory.create( descriptor );
@@ -50,7 +50,10 @@
@Test
public void testIsValid() {
+ byte b = 1;
+ Byte bWrapper = 127;
assertTrue( constraint.isValid( null, null ) );
+ assertTrue( constraint.isValid( b, null ) );
assertTrue( constraint.isValid( 15l, null ) );
assertTrue( constraint.isValid( 15, null ) );
assertTrue( constraint.isValid( 15.0, null ) );
@@ -60,6 +63,7 @@
assertTrue( constraint.isValid( 14.99, null ) );
assertTrue( constraint.isValid( -14.99, null ) );
assertFalse( constraint.isValid( 20, null ) );
+ assertFalse( constraint.isValid( bWrapper, null ) );
assertFalse( constraint.isValid( BigDecimal.valueOf( 156000000000.0 ), null ) );
assertFalse( constraint.isValid( BigInteger.valueOf( 10000000l ), null ) );
}
Modified:
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/MinValidatorForNumberTest.java
===================================================================
---
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/MinValidatorForNumberTest.java 2009-02-28
04:55:29 UTC (rev 16051)
+++
validator/trunk/hibernate-validator/src/test/java/org/hibernate/validation/constraints/MinValidatorForNumberTest.java 2009-03-02
09:47:52 UTC (rev 16052)
@@ -50,13 +50,17 @@
@Test
public void testIsValid() {
+ byte b = 1;
+ Byte bWrapper = 127;
assertTrue( constraint.isValid( null, null ) );
+ assertTrue( constraint.isValid( bWrapper, null ) );
assertTrue( constraint.isValid( 20, null ) );
assertTrue( constraint.isValid( 15l, null ) );
assertTrue( constraint.isValid( 15, null ) );
assertTrue( constraint.isValid( 15.0, null ) );
assertTrue( constraint.isValid( BigDecimal.valueOf( 156000000000.0 ), null ) );
assertTrue( constraint.isValid( BigInteger.valueOf( 10000000l ), null ) );
+ assertFalse( constraint.isValid( b, null ) );
assertFalse( constraint.isValid( BigDecimal.valueOf( -156000000000.0 ), null ) );
assertFalse( constraint.isValid( BigInteger.valueOf( -10000000l ), null ) );
assertFalse( constraint.isValid( 10, null ) );
Show replies by date