### Question:
PoulpeNotificationHandler { @RequestMapping(value = "/component", method = RequestMethod.DELETE) @ResponseBody public void deleteComponent(@RequestParam(value = "password") String adminPassword) throws NotFoundException { assertAdminPasswordCorrect(adminPassword); sectionService.deleteAllTopicsInForum(); } @Autowired  PoulpeNotificationHandler(BranchService branchService, SectionService sectionService,
                                     UserService userService); @RequestMapping(value = "/branches/{branchId}", method = RequestMethod.DELETE) @ResponseBody void deleteBranch(@PathVariable("branchId") long branchId,
                             @RequestParam(value = "password") String adminPassword); @RequestMapping(value = "/sections/{sectionId}", method = RequestMethod.DELETE) @ResponseBody void deleteSection(@PathVariable("sectionId") long sectionId,
                              @RequestParam(value = "password") String adminPassword); @RequestMapping(value = "/component", method = RequestMethod.DELETE) @ResponseBody void deleteComponent(@RequestParam(value = "password") String adminPassword); @ExceptionHandler(Exception.class) @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) ModelAndView handleAllExceptions(Exception exception);  }### Answer:
@Test public void testDeleteComponent() throws NotFoundException { doReturn(userWithPassword("password")).when(userService).getCommonUserByUsername("admin"); controller.deleteComponent("password"); verify(sectionService).deleteAllTopicsInForum(); }
@Test(expectedExceptions = NotFoundException.class) public void testDeleteComponentFail() throws NotFoundException { doReturn(userWithPassword("password")).when(userService).getCommonUserByUsername("admin"); doThrow(new NotFoundException()).when(sectionService).deleteAllTopicsInForum(); controller.deleteComponent("password"); }