Package org.javalite.activejdbc.test_models

Examples of org.javalite.activejdbc.test_models.User


public class Defect48Test extends ActiveJDBCTest{

    @Test
    public void shouldFailIfParentRequestedAndForeignKeyNotSet(){
        Address a = new Address();
        User u = a.parent(User.class);
        a(u).shouldBeNull();
    }
View Full Code Here


    @Test
    public void shouldNotIncludeNullValuesIntoInsertStatement(){
        deleteAndPopulateTable("users");

        User user = new User();
        user.set("email", "john@doe.net");

        SystemStreamUtil.replaceOut();

        user.saveIt();

        //this is tested manually, for some reason, Maven does something stupid with streams, can't catch them
    }
View Full Code Here

    public void shouldIncludeChildren(){
        deleteAndPopulateTables("users", "addresses");
        User.findById(1).add(Address.create("zip", 60606, "state", "IL", "address1", "123 Pine & Needles", "city", "Chicago"));
        List<User> personList = User.findAll().orderBy("id").include(Address.class);

        User u = personList.get(0);
        checkXmlStructure(u.toXml(true, true));
        checkXmlStructure(u.toXml(false, true));
    }
View Full Code Here

    @Test
    public void shouldIncludeOnlyProvidedAttributes(){
        deleteAndPopulateTables("users", "addresses");

        User u = User.findById(1);
        String xml = u.toXml(true, true, "email", "last_name");

        a(XPathHelper.count("/user/*", xml)).shouldEqual(2);
        a(XPathHelper.selectText("/user/email", xml)).shouldEqual("mmonroe@yahoo.com");
        a(XPathHelper.selectText("/user/last_name", xml)).shouldEqual("Monroe");
        a(XPathHelper.count("//first_name", xml)).shouldEqual(0);
View Full Code Here

TOP

Related Classes of org.javalite.activejdbc.test_models.User

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.