Examples of TopicDto


Examples of org.jtalks.jcommune.plugin.api.web.dto.TopicDto

    @Test
    public void createValidationPass() throws Exception {
        user.setAutosubscribe(true);
        Branch branch = createBranch();
        Topic topic = createTopic();
        TopicDto dto = getDto();
        BindingResult result = mock(BindingResult.class);

        //set expectations
        when(branchService.get(BRANCH_ID)).thenReturn(branch);
        when(topicModificationService.createCodeReview(topic, TOPIC_CONTENT))
View Full Code Here

Examples of org.jtalks.jcommune.plugin.api.web.dto.TopicDto

        topic.addPost(new Post(user, TOPIC_CONTENT));
        return topic;
    }

    private TopicDto getDto() {
        TopicDto dto = new TopicDto();
        Topic topic = createTopic();
        dto.setBodyText(TOPIC_CONTENT);
        dto.setTopic(topic);
        return dto;
    }
View Full Code Here

Examples of org.jtalks.jcommune.plugin.api.web.dto.TopicDto

    @Test
    public void createTopicShouldPassAndRedirectToNewTopicIfItIsValid() throws Exception {
        Branch branch = createBranch();
        Topic topic = createTopic();
        TopicDto dto = getDto();
        BindingResult result = mock(BindingResult.class);
        when(branchService.get(BRANCH_ID)).thenReturn(branch);
        when(topicModificationService.createTopic(topic, TOPIC_CONTENT)).thenReturn(topic);

        ModelAndView mav = controller.createTopic(dto, result, BRANCH_ID);
View Full Code Here

Examples of org.jtalks.jcommune.plugin.api.web.dto.TopicDto

        verify(branchService).get(BRANCH_ID);
        verify(breadcrumbBuilder).getNewTopicBreadcrumb(branch);
        //
        assertViewName(mav, "topic/topicForm");
        //
        TopicDto topicDto = assertAndReturnModelAttributeOfType(mav, "topicDto", TopicDto.class);
        Topic actualTopic = topicDto.getTopic();
        Branch actualTopicBranch = actualTopic.getBranch();
        assertEquals(actualTopicBranch, branch, "Topic template should be attached to branch where user creates branch.");
        assertNotNull(actualTopic.getPoll(), "Topic template should contain poll template.");

        //
View Full Code Here

Examples of org.jtalks.jcommune.plugin.api.web.dto.TopicDto

        verify(topicFetchService).get(TOPIC_ID);
        verify(breadcrumbBuilder).getForumBreadcrumb(topic);
        //
        assertViewName(mav, "topic/topicForm");
        //
        TopicDto dto = assertAndReturnModelAttributeOfType(mav, "topicDto", TopicDto.class);
        assertEquals(dto.getTopic().getId(), TOPIC_ID);
        //
        long branchId = assertAndReturnModelAttributeOfType(mav, "branchId", Long.class);
        assertEquals(branchId, BRANCH_ID);
        assertModelAttributeAvailable(mav, "breadcrumbList");
    }
View Full Code Here

Examples of org.jtalks.jcommune.plugin.api.web.dto.TopicDto

        verify(topicFetchService).get(TOPIC_ID);
        verify(breadcrumbBuilder).getForumBreadcrumb(topic);
        //
        assertViewName(mav, "topic/topicForm");
        //
        TopicDto dto = assertAndReturnModelAttributeOfType(mav, "topicDto", TopicDto.class);
        assertEquals(dto.getTopic().getId(), TOPIC_ID);
        //
        long branchId = assertAndReturnModelAttributeOfType(mav, "branchId", Long.class);
        assertEquals(branchId, BRANCH_ID);
        assertModelAttributeAvailable(mav, "breadcrumbList");
    }
View Full Code Here

Examples of org.jtalks.jcommune.plugin.api.web.dto.TopicDto

        controller.editTopicPage(TOPIC_ID);
    }

    @Test
    public void saveValidationPass() throws NotFoundException {
        TopicDto dto = getDto();
        BindingResult bindingResult = new BeanPropertyBindingResult(dto, "topicDto");
        when(topicFetchService.get(TOPIC_ID)).thenReturn(createTopic());

        //invoke the object under test
        ModelAndView mav = controller.editTopic(dto, bindingResult, TOPIC_ID);
        Topic topic = topicFetchService.get(TOPIC_ID);
        //check expectations
        verify(topicModificationService).updateTopic(topic, dto.getPoll());

        //check result
        assertViewName(mav, "redirect:/topics/" + TOPIC_ID);
    }
View Full Code Here

Examples of org.jtalks.jcommune.plugin.api.web.dto.TopicDto

        assertViewName(mav, "redirect:/topics/" + TOPIC_ID);
    }

    @Test
    public void saveValidationFail() throws NotFoundException {
        TopicDto dto = getDto();
        BeanPropertyBindingResult resultWithErrors = mock(BeanPropertyBindingResult.class);
        when(topicFetchService.get(TOPIC_ID)).thenReturn(this.createTopic());
        when(resultWithErrors.hasErrors()).thenReturn(true);

        ModelAndView mav = controller.editTopic(dto, resultWithErrors, TOPIC_ID);
View Full Code Here

Examples of org.jtalks.jcommune.plugin.api.web.dto.TopicDto

        topic.addPost(new Post(user, TOPIC_CONTENT));
        return topic;
    }

    private TopicDto getDto() {
        TopicDto dto = new TopicDto();
        Topic topic = createTopic();
        dto.setBodyText(TOPIC_CONTENT);
        Poll poll = new Poll();
        List<PollItem> pollItems = Arrays.asList(new PollItem("123"));
        poll.addPollOptions(pollItems);
        topic.setPoll(poll);
        dto.setTopic(topic);
        return dto;
    }
View Full Code Here

Examples of org.jtalks.jcommune.plugin.api.web.dto.TopicDto

    public ModelAndView showNewTopicPage(@RequestParam(BRANCH_ID) Long branchId) throws NotFoundException {
        Branch branch = branchService.get(branchId);
        Topic topic = new Topic();
        topic.setBranch(branch);
        topic.setPoll(new Poll());
        TopicDto dto = new TopicDto(topic);
        return new ModelAndView(TOPIC_VIEW)
                .addObject(TOPIC_DTO, dto)
                .addObject(BRANCH_ID, branchId)
                .addObject(SUBMIT_URL, "/topics/new?branchId=" + branchId)
                .addObject(BREADCRUMB_LIST, breadcrumbBuilder.getNewTopicBreadcrumb(branch));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.