### Question:
WidgetController { @RestAccessControl(permission = Permission.MANAGE_PAGES) @RequestMapping(value = "/widgets/{widgetCode}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<SimpleRestResponse<WidgetDto>> getWidget(@PathVariable String widgetCode) { logger.trace("getWidget by code {}", widgetCode); WidgetDto group = this.widgetService.getWidget(widgetCode); return new ResponseEntity<>(new SimpleRestResponse<>(group), HttpStatus.OK); }  @RestAccessControl(permission = Permission.MANAGE_PAGES) @RequestMapping(value = "/widgets/{widgetCode}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<SimpleRestResponse<WidgetDto>> getWidget(@PathVariable String widgetCode); @RestAccessControl(permission = Permission.SUPERUSER) @RequestMapping(value = "/widgets/{widgetCode}/usage", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<SimpleRestResponse<ComponentUsage>> getComponentUsage(@PathVariable String widgetCode); @RestAccessControl(permission = Permission.SUPERUSER) @RequestMapping(value = "/widgets/{widgetCode}/usage/details", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<PagedRestResponse<ComponentUsageEntity>> getComponentUsageDetails(@PathVariable String widgetCode, PageSearchRequest searchRequest); @RestAccessControl(permission = Permission.SUPERUSER) @RequestMapping(value = "/widgets/{widgetCode}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE, name = "widget") ResponseEntity<SimpleRestResponse<Map<String, String>>> deleteWidget(@PathVariable String widgetCode); @RestAccessControl(permission = Permission.SUPERUSER) @RequestMapping(value = "/widgets/{widgetCode}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE, name = "widget") ResponseEntity<SimpleRestResponse<WidgetDto>> updateWidget(@PathVariable String widgetCode, @Valid @RequestBody WidgetRequest widgetRequest, BindingResult bindingResult); @RestAccessControl(permission = Permission.MANAGE_PAGES) @RequestMapping(value = "/widgets", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, name = "widget") ResponseEntity<SimpleRestResponse<WidgetDto>> addWidget(@Valid @RequestBody WidgetRequest widgetRequest, BindingResult bindingResult); @RestAccessControl(permission = Permission.MANAGE_PAGES) @RequestMapping(value = "/widgets", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<PagedRestResponse<WidgetDto>> getWidgets(RestListRequest requestList); @RestAccessControl(permission = Permission.SUPERUSER) @RequestMapping(value = "/widgets/{widgetCode}/info", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<SimpleRestResponse<WidgetInfoDto>> getWidgetInfo(@PathVariable String widgetCode); IWidgetService getWidgetService(); void setWidgetService(IWidgetService widgetService); WidgetValidator getWidgetValidator(); void setWidgetValidator(WidgetValidator widgetValidator); static final String COMPONENT_ID; }### Answer:
@Test public void testGetWidget() throws Exception { UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24") .withAuthorization(Group.FREE_GROUP_NAME, "managePages", Permission.MANAGE_PAGES) .build(); String accessToken = mockOAuthInterceptor(user); ResultActions result = mockMvc.perform( get("/widgets/1") .header("Authorization", "Bearer " + accessToken) ); String response = result.andReturn().getResponse().getContentAsString(); assertNotNull(response); }