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

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


final public class StellaMaxValidatorTest {
  private ConstraintValidatorContext context = Mockito.mock(ConstraintValidatorContext.class);

    @Test
    public void testThatNullIsValid() {
    StellaMaxValidator validator = new StellaMaxValidator();
        Assert.assertTrue(validator.isValid(null,context));
    }
View Full Code Here


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

    @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

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

    @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));
    }
View Full Code Here

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

    @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));
    }
View Full Code Here

TOP

Related Classes of br.com.caelum.stella.bean.validation.xml.logic.StellaMaxValidator

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.