### Question:
CategoryController { @RestAccessControl(permission = { Permission.MANAGE_CATEGORIES, Permission.CONTENT_EDITOR }) @RequestMapping(value = "/{categoryCode}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<SimpleRestResponse<CategoryDto>> getCategory(@PathVariable String categoryCode) { logger.debug("getting category {}", categoryCode); CategoryDto category = this.getCategoryService().getCategory(categoryCode); return new ResponseEntity<>(new SimpleRestResponse<>(category), HttpStatus.OK); }  void setCategoryService(ICategoryService categoryService); CategoryValidator getCategoryValidator(); void setCategoryValidator(CategoryValidator categoryValidator); @RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<RestResponse<List<CategoryDto>, Map<String, String>>> getCategories(@RequestParam(value = "parentCode", required = false, defaultValue = "home") String parentCode); @RestAccessControl(permission = { Permission.MANAGE_CATEGORIES, Permission.CONTENT_EDITOR }) @RequestMapping(value = "/{categoryCode}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<SimpleRestResponse<CategoryDto>> getCategory(@PathVariable String categoryCode); @RestAccessControl(permission = Permission.MANAGE_CATEGORIES) @RequestMapping(value = "/{categoryCode}/references/{holder}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<PagedRestResponse<?>> getCategoryReferences(@PathVariable String categoryCode, @PathVariable String holder, RestListRequest requestList); @RestAccessControl(permission = Permission.MANAGE_CATEGORIES) @RequestMapping(method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<SimpleRestResponse<CategoryDto>> addCategory(@Valid @RequestBody CategoryDto categoryRequest, BindingResult bindingResult); @RestAccessControl(permission = Permission.MANAGE_CATEGORIES) @RequestMapping(value = "/{categoryCode}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<RestResponse<CategoryDto, Map<String, String>>> updateCategory(@PathVariable String categoryCode, @Valid @RequestBody CategoryDto categoryRequest, BindingResult bindingResult); @RestAccessControl(permission = Permission.MANAGE_CATEGORIES) @RequestMapping(value = "/{categoryCode}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE) ResponseEntity<SimpleRestResponse<Map<String, String>>> deleteCategory(@PathVariable String categoryCode);  }### Answer:
@Test public void testGetCategory() throws Exception { UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24") .withAuthorization(Group.FREE_GROUP_NAME, "manageCategories", Permission.MANAGE_CATEGORIES) .build(); String accessToken = mockOAuthInterceptor(user); ResultActions result = mockMvc .perform(get("/categories/{code}", "home") .header("Authorization", "Bearer " + accessToken)); result.andExpect(status().isOk()); result = mockMvc .perform(get("/categories/{code}", "home") .param("parentCode", "home")); result.andExpect(status().isUnauthorized()); }