descriptor.setValue( "integer", 5 );
descriptor.setValue( "fraction", 2 );
descriptor.setValue( "message", "{validator.digits}" );
Digits p = AnnotationFactory.create( descriptor );
DigitsValidatorForNumber constraint = new DigitsValidatorForNumber();
constraint.initialize( p );
assertTrue( constraint.isValid( null, null ) );
assertTrue( constraint.isValid( Byte.valueOf( "0" ), null ) );
assertTrue( constraint.isValid( Double.valueOf( "500.2" ), null ) );
assertTrue( constraint.isValid( new BigDecimal( "-12345.12" ), null ) );
assertFalse( constraint.isValid( new BigDecimal( "-123456.12" ), null ) );
assertFalse( constraint.isValid( new BigDecimal( "-123456.123" ), null ) );
assertFalse( constraint.isValid( new BigDecimal( "-12345.123" ), null ) );
assertFalse( constraint.isValid( new BigDecimal( "12345.123" ), null ) );
assertTrue( constraint.isValid( Float.valueOf( "-000000000.22" ), null ) );
assertFalse( constraint.isValid( Integer.valueOf( "256874" ), null ) );
assertFalse( constraint.isValid( Double.valueOf( "12.0001" ), null ) );
}