### Question:
PoulpeNotificationHandler { @RequestMapping(value = "/branches/{branchId}", method = RequestMethod.DELETE) @ResponseBody public void deleteBranch(@PathVariable("branchId") long branchId, @RequestParam(value = "password") String adminPassword) throws NotFoundException { assertAdminPasswordCorrect(adminPassword); branchService.deleteAllTopics(branchId); } @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 testDeleteBranch() throws NotFoundException { doReturn(userWithPassword("password")).when(userService).getCommonUserByUsername("admin"); controller.deleteBranch(BRANCH_ID, "password"); verify(branchService).deleteAllTopics(BRANCH_ID); }
@Test(expectedExceptions = IllegalArgumentException.class) public void shouldThrowIfEmptyPasswordWasSentByPoulpe() throws NotFoundException { controller.deleteBranch(BRANCH_ID, ""); }
@Test(expectedExceptions = IllegalArgumentException.class) public void shouldThrowIfNullPasswordWasSentByPoulpe() throws NotFoundException { controller.deleteBranch(BRANCH_ID, null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void shouldThrowIfWrongPasswordWasSentByPoulpe() throws NotFoundException { doReturn(userWithPassword("correct password")).when(userService).getCommonUserByUsername("admin"); controller.deleteBranch(BRANCH_ID, "wrong password"); }
@Test(expectedExceptions = NotFoundException.class) public void testDeleteBranchIncorrectId() throws NotFoundException { doReturn(userWithPassword("password")).when(userService).getCommonUserByUsername("admin"); when(branchService.deleteAllTopics(anyLong())).thenThrow(new NotFoundException()); controller.deleteBranch(BRANCH_ID, "password"); }