Package org.javalite.activejdbc.test_models

Examples of org.javalite.activejdbc.test_models.Person.errors()


        Person p = new Person();
        p.set("name", "Marilyn");
        p.set("last_name", "Monroe");
        p.set("dob", "1935/6/12");//wrong format
        p.validate();
        a(p.errors().size()).shouldBeEqual(1);


        p.set("dob", "1935-12-06");//right format
        p.validate();
        a(p.errors().size()).shouldBeEqual(0);
View Full Code Here


        a(p.errors().size()).shouldBeEqual(1);


        p.set("dob", "1935-12-06");//right format
        p.validate();
        a(p.errors().size()).shouldBeEqual(0);
    }

    @Test
    public void testTimestampConverter(){
        deleteAndPopulateTable("people");
View Full Code Here

        Person p = new Person();
        p.set("name", "Marilyn");
        p.set("last_name", "Monroe");
        p.set("graduation_date", "1.2.1975");//wrong format
        p.validate();
        a(p.errors().size()).shouldBeEqual(1);


        p.set("graduation_date", "1975-12-06");//right format
        p.validate();
        a(p.errors().size()).shouldBeEqual(0);
View Full Code Here

        a(p.errors().size()).shouldBeEqual(1);


        p.set("graduation_date", "1975-12-06");//right format
        p.validate();
        a(p.errors().size()).shouldBeEqual(0);
    }
}
View Full Code Here

        GregorianCalendar future = new GregorianCalendar();
        future.set(Calendar.YEAR, 3000);//will people still be using Java then... or computers? :)

        p.set("dob", new Date(future.getTimeInMillis()));
        p.validate();
        a(p.errors().size()).shouldBeEqual(3);

        a(p.errors().get("invalid.dob")).shouldBeEqual("date of birth cannot be in future");

        //this is so that other tests succeed
        Person.removeValidator(validator);
View Full Code Here

        p.set("dob", new Date(future.getTimeInMillis()));
        p.validate();
        a(p.errors().size()).shouldBeEqual(3);

        a(p.errors().get("invalid.dob")).shouldBeEqual("date of birth cannot be in future");

        //this is so that other tests succeed
        Person.removeValidator(validator);
    }
}
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.