Package sagan.blog

Examples of sagan.blog.Post


        assertThat(published, not(isIn(scheduledPosts)));
    }

    @Test
    public void listPostsForCategory() {
        Post newsPost = PostBuilder.post().title(uniqueTitle()).publishAt(yesterday).category(NEWS_AND_EVENTS).build();
        postRepository.save(newsPost);

        Page<Post> publishedPosts = service.getPublishedPosts(NEWS_AND_EVENTS, FIRST_TEN_POSTS);

        assertThat(publishedPosts.getContent(), contains(newsPost));
View Full Code Here


        assertThat(publishedPosts.getContent(), contains(newsPost));
    }

    @Test
    public void listPostsForCategoryExcludesScheduledPosts() throws ParseException {
        Post publishedRelease = PostBuilder.post().title(uniqueTitle()).publishAt(yesterday).category(RELEASES).build();
        postRepository.save(publishedRelease);
        Post scheduledRelease = PostBuilder.post().title(uniqueTitle()).publishAt(tomorrow).category(RELEASES).build();
        postRepository.save(scheduledRelease);

        List<Post> releases = service.getPublishedPosts(RELEASES, FIRST_TEN_POSTS).getContent();

        assertThat(scheduledRelease, not(isIn(releases)));
View Full Code Here

        assertThat(result.getTotalElements(), is(itemCount));
    }

    @Test
    public void listBroadcasts() {
        Post broadcast = PostBuilder.post().isBroadcast().title(uniqueTitle()).publishAt(yesterday).build();
        postRepository.save(broadcast);

        List<Post> broadcasts = service.getPublishedBroadcastPosts(FIRST_TEN_POSTS).getContent();

        assertThat(broadcasts, contains(broadcast));
View Full Code Here

        assertThat(broadcasts, contains(broadcast));
    }

    @Test
    public void listBroadcastsExcludesScheduledPosts() throws ParseException {
        Post publishedBroadcast = PostBuilder.post().title(uniqueTitle()).isBroadcast().publishAt(yesterday).build();
        postRepository.save(publishedBroadcast);
        Post scheduledBroadcast = PostBuilder.post().title(uniqueTitle()).isBroadcast().publishAt(tomorrow).build();
        postRepository.save(scheduledBroadcast);

        List<Post> broadcasts = service.getPublishedBroadcastPosts(FIRST_TEN_POSTS).getContent();

        assertThat(scheduledBroadcast, not(isIn(broadcasts)));
View Full Code Here

    @Test
    public void getPublishedPostsForAuthorOnlyShowsAuthorsPosts() {
        MemberProfile profile = new MemberProfile();
        profile.setUsername("myauthor");

        Post post = PostBuilder.post().author(profile).title(uniqueTitle()).publishAt(yesterday).build();

        postRepository.save(post);
        postRepository.save(PostBuilder.post().title(uniqueTitle()).build());

        Page<Post> publishedPosts = service.getPublishedPostsForMember(profile, FIRST_TEN_POSTS);
View Full Code Here

    @Test
    public void getPublishedPostsForAuthorOnlyShowsPublishedPosts() {
        MemberProfile profile = new MemberProfile();
        profile.setUsername("myauthor");

        Post post = PostBuilder.post().author(profile).title(uniqueTitle()).publishAt(yesterday).build();

        postRepository.save(post);
        postRepository.save(PostBuilder.post().title(uniqueTitle()).author(profile).draft().build());

        Page<Post> publishedPosts = service.getPublishedPostsForMember(profile, FIRST_TEN_POSTS);
View Full Code Here

    private void createManyPostsInNovember(int numPostsToCreate) {
        Calendar calendar = Calendar.getInstance();
        List<Post> posts = new ArrayList<>();
        for (int postNumber = 1; postNumber <= numPostsToCreate; postNumber++) {
            calendar.set(2012, 10, postNumber);
            Post post = new PostBuilder().title("This week in Spring - November " + postNumber + ", 2012")
                    .rawContent("Raw content")
                    .renderedContent("Html content")
                    .renderedSummary("Html summary")
                    .isBroadcast()
                    .createdAt(calendar.getTime())
View Full Code Here

TOP

Related Classes of sagan.blog.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.