Package org.springmodules.validation.util.date

Examples of org.springmodules.validation.util.date.DefaultDateParser


        assertFalse(validate(new Person(30, "Steven"), text));
    }

    public void testTranslator19Dates1() throws DateParseException {
        String text = "{ dateOfBirth : dateOfBirth >= [1970-01-01] : 'You must be born after 1 January 1970.' }";
        assertTrue(validate(new Person(new DefaultDateParser().parse("1974-11-24")), text));
        assertFalse(validate(new Person(new DefaultDateParser().parse("1950-07-14")), text));
    }
View Full Code Here


        assertFalse(validate(new Person(new DefaultDateParser().parse("1950-07-14")), text));
    }

    public void testTranslator20Dates2() throws DateParseException {
        String text = "{ dateOfBirth : ? is null or (dateOfBirth >= [T<d] and [T>d] > dateOfBirth) : 'You must be born today.' }";
        assertTrue(validate(new Person(new DefaultDateParser().parse("T")), text));
        assertFalse(validate(new Person(new DefaultDateParser().parse("T-1d")), text));
    }
View Full Code Here

        assertFalse(md("20050409"), OperatorConstants.MORE_THAN_OR_EQUAL_OPERATOR, md("2005-04-10"));
    }

    public Date md(String s) {
        try {
            return new DefaultDateParser().parse(s);
        } catch (DateParseException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

    private ServletContext servletContext = null;

    public DefaultVisitor() {
        if (JdkVersion.getMajorJavaVersion() != JdkVersion.JAVA_13) {
            this.dateParser = new DefaultDateParser();
        }
    }
View Full Code Here

        assertFalse(validate(new Person(30, "Steven"), text));
    }

    public void testParser19Dates1() throws DateParseException {
        String text = "{ dateOfBirth : dateOfBirth >= [1970-01-01] : 'You must be born after 1 january 1970.' }";
        assertTrue(validate(new Person(new DefaultDateParser().parse("1974-11-24")), text));
        assertFalse(validate(new Person(new DefaultDateParser().parse("1950-07-14")), text));
    }
View Full Code Here

        assertFalse(validate(new Person(new DefaultDateParser().parse("1950-07-14")), text));
    }

    public void testParser20Dates2() throws DateParseException {
        String text = "{ dateOfBirth : ? is null or (dateOfBirth >= [T<d] and [T>d] > dateOfBirth) : 'You must be born today.' }";
        assertTrue(validate(new Person(new DefaultDateParser().parse("T")), text));
        assertFalse(validate(new Person(new DefaultDateParser().parse("T-1d")), text));
    }
View Full Code Here

        assertFalse(md("20050409"), Operator.GREATER_THAN_OR_EQUAL, md("2005-04-10"));
    }

    public Date md(String s) {
        try {
            return new DefaultDateParser().parse(s);
        } catch (DateParseException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

        assertFalse(validate(new Person(30, "Steven"), text));
    }

    public void testTranslator19Dates1() throws DateParseException {
        String text = "{ dateOfBirth : dateOfBirth >= [1970-01-01] : 'You must be born after 1 January 1970.' }";
        assertTrue(validate(new Person(new DefaultDateParser().parse("1974-11-24")), text));
        assertFalse(validate(new Person(new DefaultDateParser().parse("1950-07-14")), text));
    }
View Full Code Here

        assertFalse(validate(new Person(new DefaultDateParser().parse("1950-07-14")), text));
    }

    public void testTranslator20Dates2() throws DateParseException {
        String text = "{ dateOfBirth : ? is null or (dateOfBirth >= [T<d] and [T>d] > dateOfBirth) : 'You must be born today.' }";
        assertTrue(validate(new Person(new DefaultDateParser().parse("T")), text));
        assertFalse(validate(new Person(new DefaultDateParser().parse("T-1d")), text));
    }
View Full Code Here

    /**
     * Constructor
     */
    public DefaultVisitor() {
        this.dateParser = new DefaultDateParser();
    }
View Full Code Here

TOP

Related Classes of org.springmodules.validation.util.date.DefaultDateParser

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.