Package org.apache.bval.constraints

Examples of org.apache.bval.constraints.DigitsValidatorForString


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

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


        val = new Long("99");
        Assert.assertTrue(validator.isValid(val, null));
    }

    public void testValidateString2() {
        DigitsValidatorForString validator = new DigitsValidatorForString();
        validator.setFractional(0);
        validator.setIntegral(2);
        String val = "99.5";
        Assert.assertFalse(validator.isValid(val, null));
        val = "99";
        Assert.assertTrue(validator.isValid(val, null));
    }
View Full Code Here

TOP

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

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.