Package org.javalite.activejdbc.test_models

Examples of org.javalite.activejdbc.test_models.Post


     */
    @Test
    public void shouldBeAbleToIncludePolymorphicParent() {
        deleteAndPopulateTables("comments", "articles", "posts");

        Post p = Post.findById(1);
        p.add(Comment.create("author", "eleonard", "content", "this is just a test comment text"));

        Article a = Article.findById(2);
        a.add(Comment.create("author", "eleonard", "content", "this is just a test comment text"));

        final LazyList<Comment> comments = Comment.findAll().orderBy("id").include(Article.class, Post.class);
View Full Code Here


        List<Comment> comments = a.getAll(Comment.class).orderBy("id");

        a(comments.size()).shouldBeEqual(2);
        a(comments.get(0).get("author")).shouldBeEqual("ipolevoy");

        Post p = Post.findById(2);
        p.add(Comment.create("author", "jjohnes", "content", "this is just a test comment text"));
        p.add(Comment.create("author", "alapsi", "content", "this is another test comment text"));
        p.add(Comment.create("author", "kmandy", "content", "this is just a test comment text"));
        comments = p.getAll(Comment.class).orderBy("id");

        a(comments.size()).shouldBeEqual(3);
        a(comments.get(0).get("author")).shouldBeEqual("jjohnes");
        a(comments.get(1).get("author")).shouldBeEqual("alapsi");
        a(comments.get(2).get("author")).shouldBeEqual("kmandy");
View Full Code Here

TOP

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

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.