Package org.springmodules.validation.valang.parser

Examples of org.springmodules.validation.valang.parser.Person


        }
    }

    public void testTranslator1SimpleRule() {
        String text = "{age : age <= 120 : 'We do not do business with the undead.'}";
        assertTrue(validate(new Person(30, "Steven"), text));
    }
View Full Code Here


    }

    public void testTranslator2TwoSimpleRules() {
        String text = "{age : age >= 18 : 'Our customers must be 18 years or older.'}\n"
                + "{age : age <= 120 : 'We do not do business with the undead.'}";
        assertTrue(validate(new Person(30, "Steven"), text));
        assertFalse(validate(new Person(150, "Steven"), text));
    }
View Full Code Here

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

    public void testTranslator3LengthRule() {
        String text = "{firstName : length (firstName) < 7 and length (firstName) > -1 : 'First name must be no longer than 30 characters.'}";
        assertTrue(validate(new Person(30, "Steven"), text));
        assertFalse(validate(new Person(7, "Benjamin"), text));
    }
View Full Code Here

        assertFalse(validate(new Person(7, "Benjamin"), text));
    }

    public void testTranslator4NullRule() {
        String text = "{firstName : firstName is null : 'First name must be null.'}";
        assertTrue(validate(new Person(20, null), text));
        assertFalse(validate(new Person(30, "Steven"), text));
    }
View Full Code Here

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

    public void testTranslator5NotNullRule() {
        String text = "{firstName : firstName is not null : 'First name must not be null.'}";
        assertTrue(validate(new Person(30, "Steven"), text));
        assertFalse(validate(new Person(20, null), text));
    }
View Full Code Here

        assertFalse(validate(new Person(20, null), text));
    }

    public void testTranslator6HasLengthRule() {
        String text = "{firstName : firstName has length : 'First name is required.'}";
        assertTrue(validate(new Person(30, "Steven"), text));
        assertFalse(validate(new Person(20, ""), text));
    }
View Full Code Here

        assertFalse(validate(new Person(20, ""), text));
    }

    public void testTranslator7HasNoLengthRule() {
        String text = "{firstName : firstName has no length : 'First name is not allowed.'}";
        assertTrue(validate(new Person(20, null), text));
        assertFalse(validate(new Person(30, "Steven"), text));
    }
View Full Code Here

    }

    public void testTranslator1SimpleRule() {
        String text = "{age : age <= 120 : 'We do not do business with the undead.'}";
        assertTrue(validate(new Person(30, "Steven"), text));
    }
View Full Code Here

    }

    public void testTranslator2TwoSimpleRules() {
        String text = "{age : age >= 18 : 'Our customers must be 18 years or older.'}\n"
            + "{age : age <= 120 : 'We do not do business with the undead.'}";
        assertTrue(validate(new Person(30, "Steven"), text));
        assertFalse(validate(new Person(150, "Steven"), text));
    }
View Full Code Here

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

    public void testTranslator3LengthRule() {
        String text = "{firstName : length (firstName) < 7 and length (firstName) > -1 : 'First name must be no longer than 30 characters.'}";
        assertTrue(validate(new Person(30, "Steven"), text));
        assertFalse(validate(new Person(7, "Benjamin"), text));
    }
View Full Code Here

TOP

Related Classes of org.springmodules.validation.valang.parser.Person

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.