### Question:
PollController { @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); } @Autowired  PollController(PollService pollService); @RequestMapping(value = "/poll/{pollId}/single", method = RequestMethod.POST) @ResponseBody PollDto addSingleVote(@PathVariable Long pollId, @RequestParam Long pollOptionId); @RequestMapping(value = "/poll/{pollId}/multiple", method = RequestMethod.POST) @ResponseBody PollDto addMultipleVote(@PathVariable Long pollId, @RequestBody PollDto pollDto); @ExceptionHandler(AccessDeniedException.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) ModelAndView handleAllExceptions(Exception exception);  }### Answer:
@Test public void testAddSingleVote() { 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"); }