Package org.jtalks.jcommune.web.dto

Examples of org.jtalks.jcommune.web.dto.PostDto


        //invoke the object under test
        ModelAndView actualMav = controller.editPage(POST_ID);
        //check result
        this.assertEditPostFormMavIsCorrect(actualMav);

        PostDto dto = assertAndReturnModelAttributeOfType(actualMav, "postDto", PostDto.class);
        assertEquals(dto.getId(), TOPIC_ID);

        assertModelAttributeAvailable(actualMav, "breadcrumbList");
    }
View Full Code Here


        assertModelAttributeAvailable(actualMav, "breadcrumbList");
    }

    @Test
    public void testUpdatePost() throws NotFoundException {
        PostDto dto = getDto();
        BindingResult bindingResult = new BeanPropertyBindingResult(dto, "postDto");
        ModelAndView mav = controller.update(dto, bindingResult, POST_ID);
        assertViewName(mav, "redirect:/posts/" + dto.getId());
        verify(postService).updatePost(Matchers.<Post>any(), anyString());
    }
View Full Code Here

        verify(postService).updatePost(Matchers.<Post>any(), anyString());
    }

    @Test
    public void updateWithError() throws NotFoundException {
        PostDto dto = this.getDto();
        BeanPropertyBindingResult resultWithErrors = mock(BeanPropertyBindingResult.class);

        when(resultWithErrors.hasErrors()).thenReturn(true);

        ModelAndView mav = controller.update(dto, resultWithErrors, POST_ID);
View Full Code Here

    private void assertAnswerMavIsCorrect(ModelAndView mav) {
        assertViewName(mav, "topic/answer");
        assertAndReturnModelAttributeOfType(mav, "topic", Topic.class);
        long topicId = assertAndReturnModelAttributeOfType(mav, "topicId", Long.class);
        assertEquals(topicId, TOPIC_ID);
        PostDto dto = assertAndReturnModelAttributeOfType(mav, "postDto", PostDto.class);
        assertEquals(dto.getId(), 0);
        assertModelAttributeAvailable(mav, "breadcrumbList");
    }
View Full Code Here

        assertEquals(topicId, TOPIC_ID);
        assertEquals(postId, POST_ID);
    }

    private PostDto getDto() {
        PostDto dto = new PostDto();
        dto.setId(POST_ID);
        dto.setBodyText(POST_CONTENT);
        dto.setTopicId(TOPIC_ID);
        return dto;
    }
View Full Code Here

        return new ModelAndView("topic/postList")
                .addObject("viewList", locationService.getUsersViewing(topic))
                .addObject("usersOnline", sessionRegistry.getAllPrincipals())
                .addObject("postsPage", postsPage)
                .addObject("topic", topic)
                .addObject(POST_DTO, new PostDto())
                .addObject("subscribed", topic.getSubscribers().contains(currentUser))
                .addObject(BREADCRUMB_LIST, breadcrumbBuilder.getForumBreadcrumb(topic));
    }
View Full Code Here

TOP

Related Classes of org.jtalks.jcommune.web.dto.PostDto

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.