Package br.com.caelum.stella.bean.validation.xml.logic

Examples of br.com.caelum.stella.bean.validation.xml.logic.StellaMaxValidator.initialize()


    @Test
    public void testThatAcceptsOnlyByteShortIntegerAndLong() {
        StellaMaxValidator validator = new StellaMaxValidator();

        validator.initialize(new Mirror().on(AnnotatedModel.class).reflect().annotation(Max.class).atField("b"));
        Assert.assertTrue(validator.isValid((byte) 10,context));
        Assert.assertTrue(validator.isValid((short) 10,context));
        Assert.assertTrue(validator.isValid(10,context));
        Assert.assertTrue(validator.isValid((long) 10,context));
    }
View Full Code Here


    }

    @Test
    public void testThatIsInvalidIfValueIsBiggerThanAnnotatedValue() {
        StellaMaxValidator validator = new StellaMaxValidator();
        validator.initialize(new Mirror().on(AnnotatedModel.class).reflect().annotation(Max.class).atField("b"));

        Assert.assertFalse(validator.isValid(21,context));
    }

    @Test
View Full Code Here

    }

    @Test
    public void testThatIsValidIfValueIsEqualToAnnotatedValue() {
        StellaMaxValidator validator = new StellaMaxValidator();
        validator.initialize(new Mirror().on(AnnotatedModel.class).reflect().annotation(Max.class).atField("b"));

        Assert.assertTrue(validator.isValid(10,context));
    }

    public static class AnnotatedModel {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.