Package org.apache.bval.constraints

Examples of org.apache.bval.constraints.DigitsValidatorForNumber


    public DigitsValidatorTest(String name) {
        super(name);
    }

    public void testValidateNumber() {
        DigitsValidatorForNumber validator = new DigitsValidatorForNumber();
        validator.setFractional(4);
        validator.setIntegral(2);
        BigDecimal val = new BigDecimal("100.12345");
        Assert.assertFalse(validator.isValid(val, null));
        val = new BigDecimal("99.1234");
        Assert.assertTrue(validator.isValid(val, null));
    }
View Full Code Here


        val = "99.1234";
        Assert.assertTrue(validator.isValid(val, null));
    }

    public void testValidateNumber2() {
        DigitsValidatorForNumber validator = new DigitsValidatorForNumber();
        validator.setFractional(4);
        validator.setIntegral(2);
        Long val = new Long("100");
        Assert.assertFalse(validator.isValid(val, null));
        val = new Long("99");
        Assert.assertTrue(validator.isValid(val, null));
    }
View Full Code Here

TOP

Related Classes of org.apache.bval.constraints.DigitsValidatorForNumber

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.