Examples of PollDto


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

    public void testAddMultipleVote() {
        long firstOptionId = 1;
        long secondOptionId = 2;
        List<Long> optionIds = Arrays.asList(firstOptionId, secondOptionId);
        Poll poll = createPoll(POLL_ID, optionIds);
        PollDto pollDto = new PollDto(poll);

        Mockito.when(pollService.vote(POLL_ID, optionIds)).thenReturn(poll);

        PollDto resultPollDto = pollController.addMultipleVote(POLL_ID, pollDto);

        Assert.assertEquals(resultPollDto.getId(), poll.getId(), "The id must be the same.");
        PollOptionDto firstOptionDto = resultPollDto.getPollOptions().get(0);
        Assert.assertEquals(firstOptionDto.getId(), firstOptionId,
                "The id must be the same");
        PollOptionDto secondOptionDto = resultPollDto.getPollOptions().get(1);
        Assert.assertEquals(secondOptionDto.getId(), secondOptionId,
                "The id must be the same");

    }
View Full Code Here

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

        long pollOptionId = 1;
        Poll poll = createPoll(POLL_ID, Arrays.asList(pollOptionId));

        Mockito.when(pollService.vote(POLL_ID, Arrays.asList(pollOptionId))).thenReturn(poll);

        PollDto pollDto = pollController.addSingleVote(POLL_ID, pollOptionId);
        PollOptionDto optionDto = pollDto.getPollOptions().get(0);

        Assert.assertEquals(pollDto.getId(), poll.getId(), "The id must be the same.");
        Assert.assertEquals(optionDto.getId(), pollOptionId, "The id must be the same");
    }
View Full Code Here

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

     */
    @RequestMapping(value = "/poll/{pollId}/single", method = RequestMethod.POST)
    @ResponseBody
    public PollDto addSingleVote(@PathVariable Long pollId, @RequestParam Long pollOptionId) {
        Poll poll = pollService.vote(pollId, Collections.singletonList(pollOptionId));
        return new PollDto(poll);
    }
View Full Code Here

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

     */
    @RequestMapping(value = "/poll/{pollId}/multiple", method = RequestMethod.POST)
    @ResponseBody
    public PollDto addMultipleVote(@PathVariable Long pollId, @RequestBody PollDto pollDto) {
        Poll poll = pollService.vote(pollId, pollDto.getPollOptionIds());
        return new PollDto(poll);
    }
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.