Package sagan.blog

Examples of sagan.blog.Post


    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").createdAt(calendar.getTime())
                    .publishAt(calendar.getTime()).build();
            posts.add(post);
View Full Code Here


                .map(Element::text).collect(toList());
        assertThat(titles, contains("Back to Work", "Off to the Sales", "Happy New Year"));
    }

    private Post createPublishedPost(String title, String publishAt) throws ParseException {
        Post post = PostBuilder.post().title(title).publishAt(publishAt).build();
        return postRepository.save(post);
    }
View Full Code Here

                .title("Title 3")
                .rawContent("Content")
                .category(PostCategory.ENGINEERING).build();
        postRepository.save(post3);

        Post oldPost = PostBuilder.post()
                .publishAt("2012-04-01 11:00")
                .title("Old Post")
                .rawContent("Content")
                .category(PostCategory.ENGINEERING).build();
        postRepository.save(oldPost);
View Full Code Here

    }

    @Test
    public void givenManyPosts_blogYearMonthDayIndexShowsPaginationControl() throws Exception {
        for (int i = 0; i < 24; ++i) {
            Post post = PostBuilder.post()
                    .publishAt(String.format("2012-11-02 %02d:00", i))
                    .title(String.format("Title %d", i))
                    .rawContent("Content")
                    .category(PostCategory.ENGINEERING).build();
            postRepository.save(post);
View Full Code Here

    }

    @Test
    public void givenManyPosts_blogYearMonthIndexShowsPaginationControl() throws Exception {
        for (int i = 1; i < 25; ++i) {
            Post post = PostBuilder.post()
                    .publishAt(String.format("2012-06-%02d 11:00", i))
                    .title(String.format("Title %d", i))
                    .rawContent("Content")
                    .category(PostCategory.ENGINEERING).build();
            postRepository.save(post);
View Full Code Here

    }

    @Test
    public void givenManyPosts_blogYearIndexShowsPaginationControl() throws Exception {
        for (int i = 1; i < 25; ++i) {
            Post post = PostBuilder.post()
                    .publishAt(String.format("2012-11-%02d 11:00", i))
                    .title(String.format("Title %d", i))
                    .rawContent("Content")
                    .category(PostCategory.ENGINEERING).build();
            postRepository.save(post);
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")
                    .category(PostCategory.ENGINEERING)
                    .createdAt(calendar.getTime())
View Full Code Here

        assertThat(service.getPublishedPost(published.getPublicSlug()), equalTo(published));
    }

    @Test
    public void getPublishedDoesNotFindDrafts() {
        Post draft = PostBuilder.post().title(uniqueTitle()).draft().build();
        postRepository.save(draft);
        expected.expect(PostNotFoundException.class);
        service.getPublishedPost(draft.getPublicSlug());
    }
View Full Code Here

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

    @Test
    public void getAllPublishedPosts() {
        Post anotherPost = PostBuilder.post().publishAt(yesterday).title("another post").build();
        postRepository.save(anotherPost);
        List<Post> publishedPosts = service.getAllPublishedPosts();

        assertThat(publishedPosts, containsInAnyOrder(published, anotherPost));
    }
View Full Code Here

        assertThat(scheduledPosts, contains(scheduled));
    }

    @Test
    public void getScheduledPostsExcludesScheduledDrafts() throws ParseException {
        Post scheduledDraft = PostBuilder.post().title(uniqueTitle()).draft().publishAt(tomorrow).build();
        postRepository.save(scheduledDraft);

        List<Post> scheduledPosts = service.getScheduledPosts(FIRST_TEN_POSTS).getContent();

        assertThat(scheduledDraft, not(isIn(scheduledPosts)));
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.