### Question:
TopicController { @RequestMapping(value = "/topics/{topicId}", method = RequestMethod.DELETE) public ModelAndView deleteTopic(@PathVariable(TOPIC_ID) Long topicId) throws NotFoundException { Topic topic = topicFetchService.get(topicId); topicModificationService.deleteTopic(topic); return new ModelAndView("redirect:/branches/" + topic.getBranch().getId()); } @Autowired  TopicController(TopicModificationService topicModificationService,
                           PostService postService,
                           BranchService branchService,
                           UserService userService,
                           BreadcrumbBuilder breadcrumbBuilder,
                           LocationService locationService,
                           SessionRegistry sessionRegistry,
                           TopicFetchService topicFetchService,
                           TopicDraftService topicDraftService,
                           EntityToDtoConverter converter,
                           RetryTemplate retryTemplate); @InitBinder void initBinder(WebDataBinder binder); @RequestMapping(value = "/topics/new", method = RequestMethod.GET) ModelAndView showNewTopicPage(@RequestParam(BRANCH_ID) Long branchId); @RequestMapping(value = "/topics/new", method = RequestMethod.POST) ModelAndView createTopic(@Valid @ModelAttribute final TopicDto topicDto,
                                    BindingResult result,
                                    @RequestParam(BRANCH_ID) Long branchId); @RequestMapping(value = "/topics/draft", method = RequestMethod.POST) @ResponseBody JsonResponse saveDraft(@Valid @RequestBody TopicDraft topicDraft,
                                  BindingResult result); @RequestMapping(value = "/topics/draft", method = RequestMethod.DELETE) @ResponseBody JsonResponse deleteDraft(); @RequestMapping(value = "/topics/{topicId}", method = RequestMethod.DELETE) ModelAndView deleteTopic(@PathVariable(TOPIC_ID) Long topicId); @RequestMapping(value = "/topics/{topicId}", method = RequestMethod.GET) ModelAndView showTopicPage(WebRequest request, @PathVariable(TOPIC_ID) Long topicId,
                                      @RequestParam(value = "page", defaultValue = "1", required = false) String page); @RequestMapping(value = "/topics/{topicId}/edit", method = RequestMethod.GET) ModelAndView editTopicPage(@PathVariable(TOPIC_ID) Long topicId); @RequestMapping(value = "/topics/{topicId}/edit", method = RequestMethod.POST) ModelAndView editTopic(@Valid @ModelAttribute TopicDto topicDto,
                                  BindingResult result,
                                  @PathVariable(TOPIC_ID) Long topicId); @RequestMapping(value = "/topics/move/json/{topicId}", method = RequestMethod.POST) @ResponseBody JsonResponse moveTopic(@PathVariable(TOPIC_ID) Long topicId,
                          @RequestParam(BRANCH_ID) Long branchId); @RequestMapping(value = "/topics/{topicId}/close") String closeTopic(@PathVariable(TOPIC_ID) Long topicId); @RequestMapping(value = "/topics/{topicId}/open") String openTopic(@PathVariable(TOPIC_ID) Long topicId); static final String TOPIC_ID; static final String BRANCH_ID; static final String BREADCRUMB_LIST; static final String POST_DTO; static final String POLL; }### Answer:
@Test public void delete() throws NotFoundException { Topic topic = new Topic(null, null); branch.addTopic(topic); when(topicFetchService.get(anyLong())).thenReturn(topic); ModelAndView actualMav = controller.deleteTopic(TOPIC_ID); assertViewName(actualMav, "redirect:/branches/" + BRANCH_ID); verify(topicModificationService).deleteTopic(topic); }