### Question:
ExternalLinkController { @RequestMapping(value = "/links/delete/{id}", method = RequestMethod.DELETE) @ResponseBody public JsonResponse deleteLink(@PathVariable Long id) { Component component = componentService.getComponentOfForum(); boolean result = service.deleteLink(id, component); return new JsonResponse(JsonResponseStatus.SUCCESS, result); } @Autowired  ExternalLinkController(ExternalLinkService service, ComponentService componentService); @RequestMapping(value = "/links/save", method = RequestMethod.POST) @ResponseBody JsonResponse saveLink(@Valid @RequestBody ExternalLink link, BindingResult result); @RequestMapping(value = "/links/delete/{id}", method = RequestMethod.DELETE) @ResponseBody JsonResponse deleteLink(@PathVariable Long id);  }### Answer:
@Test public void testDeleteLink() throws Exception { boolean expectedResult = true; long id = 1L; doReturn(expectedResult).when(service).deleteLink(eq(id), any(Component.class)); JsonResponse expected = controller.deleteLink(id); assertEquals(expected.getStatus(), JsonResponseStatus.SUCCESS); verify(service).deleteLink(eq(id), any(Component.class)); }