### Question:
WidgetApi extends AbstractRestApi { @RequestMapping(method = RequestMethod.POST, value = "/{widgetId}/comments/{widgetCommentId}") public void updateWidgetComment(@PathVariable String widgetId, @PathVariable String widgetCommentId, @RequestParam String text, HttpServletResponse response) { WidgetComment widgetComment = widgetService.getWidgetComment(widgetId, widgetCommentId); if (widgetComment == null) { widgetComment = new WidgetCommentImpl(); widgetComment.setUserId(userService.getAuthenticatedUser().getId()); widgetComment.setCreatedDate(new Date()); widgetComment.setLastModifiedDate(new Date()); widgetComment.setText(text); widgetService.createWidgetComment(widgetId, widgetComment); } else { widgetComment.setText(text); widgetService.updateWidgetComment(widgetId, widgetComment); } response.setStatus(HttpStatus.NO_CONTENT.value()); } @Autowired  WidgetApi(UserService userService,
                     TagService tagService, WidgetService widgetService); @RequestMapping(method = RequestMethod.GET) void getAllWidgets(); @RequestMapping(method = RequestMethod.POST, value = "/{widgetId}/comments") void createWidgetComment(@PathVariable String widgetId,
                                    @RequestParam String text,
                                    HttpServletResponse response); @ResponseBody @RequestMapping(method = RequestMethod.GET, value = "/{widgetId}/comments/{widgetCommentId}") WidgetComment getWidgetComment(@PathVariable String widgetId,
                                          @PathVariable String widgetCommentId); @RequestMapping(method = RequestMethod.POST, value = "/{widgetId}/comments/{widgetCommentId}") void updateWidgetComment(@PathVariable String widgetId,
                                    @PathVariable String widgetCommentId,
                                    @RequestParam String text,
                                    HttpServletResponse response); @RequestMapping(method = RequestMethod.DELETE, value = "/{widgetId}/comments/{widgetCommentId}") void deleteWidgetComment(@PathVariable String widgetId,
                                    @PathVariable String widgetCommentId,
                                    HttpServletResponse response); @RequestMapping(value = "/{widgetId}/rating", method = RequestMethod.DELETE) void deleteWidgetRating(@PathVariable String widgetId,
                                   HttpServletResponse response); @RequestMapping(value = "/{widgetId}/rating", method = RequestMethod.POST) void setWidgetRating(@PathVariable String widgetId,
                                @RequestParam(value = "score") Integer score,
                                HttpServletResponse response); @ResponseBody @RequestMapping(method = RequestMethod.GET, value = "/{widgetId}/users") List<Person> getAllUsers(@PathVariable String widgetId); @RequestMapping(method = RequestMethod.POST, value = "/{widgetId}/tags") void createWidgetTag(@PathVariable String widgetId,
                                @RequestParam String tagText,
                                HttpServletResponse response); @ResponseBody @RequestMapping(method = RequestMethod.GET, value = "/{widgetId}/tags") List<Tag> getTags(@PathVariable String widgetId, HttpServletResponse response); @ResponseBody @RequestMapping(method = RequestMethod.GET, value = "/tags") List<Tag> getAllTags();  }### Answer:
@Test public void updateWidgetComment() { String message = "updated comment"; WidgetComment widgetComment = new WidgetCommentImpl("2"); expect(widgetService.getWidgetComment("2", "2")).andReturn(widgetComment); widgetService.updateWidgetComment("2", widgetComment); replay(widgetService); HttpServletResponse httpServletResponse = createMock(HttpServletResponse.class); httpServletResponse.setStatus(HttpStatus.NO_CONTENT.value()); replay(httpServletResponse); widgetApi.updateWidgetComment("2", "2", message, httpServletResponse); assertEquals(message, widgetComment.getText()); verify(widgetService, httpServletResponse); }