### Question:
ReadPostsController { @RequestMapping("/branches/{id}/markread") public String markAllTopicsAsRead(@PathVariable long id) throws NotFoundException { Branch branch = branchService.get(id); lastReadPostService.markAllTopicsAsRead(branch); return "redirect:/branches/" + id; } @Autowired  ReadPostsController(BranchService branchService, LastReadPostService lastReadPostService,
                               RetryTemplate retryTemplate, TopicFetchService topicService); @RequestMapping(value = "/recent/forum/markread", method = RequestMethod.GET) String markAllForumAsReadFromRecentActivity(); @RequestMapping(value = "/main/forum/markread", method = RequestMethod.GET) String markAllForumAsReadFromMainPage(); @RequestMapping("/branches/{id}/markread") String markAllTopicsAsRead(@PathVariable long id); @ResponseBody @RequestMapping("/topics/{topicId}/page/{pageNum}/markread") String markTopicPageAsReadById(@PathVariable long topicId,
                                          @PathVariable int pageNum);  }### Answer:
@Test public void markAllTopicsAsReadShouldMarkThemAndUpdatePage() throws NotFoundException { Long markedBranchId = 1L; Branch willBeMarkedBranch = new Branch("branch", "new branch"); when(branchService.get(markedBranchId)).thenReturn(willBeMarkedBranch); String result = controller.markAllTopicsAsRead(markedBranchId); assertEquals(result, "redirect:/branches/" + String.valueOf(markedBranchId)); verify(lastReadPostService).markAllTopicsAsRead(willBeMarkedBranch); }