Package net.sourceforge.annovalidator.builtin.validators.ValidateCompositeDate

Examples of net.sourceforge.annovalidator.builtin.validators.ValidateCompositeDate.CompositeDateValidator.validate()


            throws ReportedValidationException {
        ThreePartDateDMY testObject = new ThreePartDateDMY("04", "1", "2008");
        CompositeDateValidator validator = new CompositeDateValidator();
        CompositeDatePart[] dateParts = testObject.getClass().getAnnotation(
                ValidateCompositeDate.class).dateParts();
        assertTrue(validator.validate(testObject, dateParts, ""));
    }

    @Test
    public void testValidationMethodPassWithTwoDigitMonth()
            throws ReportedValidationException {
View Full Code Here


            throws ReportedValidationException {
        ThreePartDateDMY testObject = new ThreePartDateDMY("04", "10", "2008");
        CompositeDateValidator validator = new CompositeDateValidator();
        CompositeDatePart[] dateParts = testObject.getClass().getAnnotation(
                ValidateCompositeDate.class).dateParts();
        assertTrue(validator.validate(testObject, dateParts, ""));
    }

    @Test(expected=ReportedValidationException.class)
    public void testValidationMethodFailWithOutOfBoundsMonth()
            throws ReportedValidationException {
View Full Code Here

            throws ReportedValidationException {
        ThreePartDateDMY testObject = new ThreePartDateDMY("04", "14", "2008");
        CompositeDateValidator validator = new CompositeDateValidator();
        CompositeDatePart[] dateParts = testObject.getClass().getAnnotation(
                ValidateCompositeDate.class).dateParts();
        validator.validate(testObject, dateParts, "");
    }

    @Test
    public void testValidationMethodPassWithThreeCharacterMonth()
            throws ReportedValidationException {
View Full Code Here

            throws ReportedValidationException {
        ThreePartDateDMY testObject = new ThreePartDateDMY("04", "OCT", "2008");
        CompositeDateValidator validator = new CompositeDateValidator();
        CompositeDatePart[] dateParts = testObject.getClass().getAnnotation(
                ValidateCompositeDate.class).dateParts();
        assertTrue(validator.validate(testObject, dateParts, ""));
    }

    @Test
    public void testValidationMethodPassWithThreeDigitDay()
            throws ReportedValidationException {
View Full Code Here

            throws ReportedValidationException {
        TwoPartDateDY testObject = new TwoPartDateDY("364", "2008");
        CompositeDateValidator validator = new CompositeDateValidator();
        CompositeDatePart[] dateParts = testObject.getClass().getAnnotation(
                ValidateCompositeDate.class).dateParts();
        assertTrue(validator.validate(testObject, dateParts, ""));
    }

    @Test
    public void testValidationMethodFailWithInvalidFormat() {
        TwoPartDateDY testObject = new TwoPartDateDY("3645", "2008");
View Full Code Here

        CompositeDateValidator validator = new CompositeDateValidator();
        CompositeDatePart[] dateParts = testObject.getClass().getAnnotation(
                ValidateCompositeDate.class).dateParts();
        String errorCode = "invalidDatePart";
        try {
            validator.validate(testObject, dateParts, errorCode);
            fail();
        } catch (ReportedValidationException e) {
            assertEquals(errorCode, e.getErrorCode());
        }
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.