Package org.jtalks.jcommune.model.entity

Examples of org.jtalks.jcommune.model.entity.LastReadPost


    }

    /*===== Common methods =====*/
    @Test
    public void testGet() {
        LastReadPost expected = PersistedObjectsFactory.getDefaultLastReadPost();
        session.save(expected);

        LastReadPost actual = lastReadPostDao.get(expected.getId());

        assertNotNull(actual, "Get returns null.");
        assertEquals(actual.getId(), expected.getId(),
                "Get return incorrect object");
    }
View Full Code Here


                "Get return incorrect object");
    }

    @Test
    public void dateOfTheLastReadPostShouldBeUpdated() {
        LastReadPost post = PersistedObjectsFactory.getDefaultLastReadPost();
        post.setPostCreationDate(new DateTime());
        session.save(post);
        DateTime newPostDate = post.getPostCreationDate().plusMinutes(34);
        post.setPostCreationDate(newPostDate);

        lastReadPostDao.saveOrUpdate(post);
        LastReadPost updatedPost = (LastReadPost) session.get(LastReadPost.class, post.getId());

        assertEquals(updatedPost.getPostCreationDate(), newPostDate,
                "Update doesn't work, because field value didn't change.");
    }
View Full Code Here

    }

    /*===== Specific methods =====*/
    @Test
    public void testListLastReadPostsForTopic() {
        LastReadPost post = PersistedObjectsFactory.getDefaultLastReadPost();
        session.save(post);

        List<LastReadPost> lastReadPosts = lastReadPostDao.getLastReadPostsInTopic(post.getTopic());

        assertTrue(lastReadPosts.size() == 1, "Result list has incorrect size");
        assertEquals(lastReadPosts.get(0).getId(), post.getId(),
                "Results contains invalid data.");
    }
View Full Code Here

                "Results contains invalid data.");
    }

    @Test
    public void testGetLastReadPost() {
        LastReadPost expected = PersistedObjectsFactory.getDefaultLastReadPost();
        session.save(expected);

        LastReadPost actual = lastReadPostDao.getLastReadPost(expected.getUser(), expected.getTopic());

        assertEquals(actual.getId(), expected.getId(),
                "Found incorrect last read post.");
    }
View Full Code Here

TOP

Related Classes of org.jtalks.jcommune.model.entity.LastReadPost

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.