TagTypeRestController { @RequestMapping(value = TAG_TYPES_URI_PREFIX + "/{tagTypeCode}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_TAG_TYPES_GET) public TagType getTagType(@PathVariable("tagTypeCode") String tagTypeCode) { return tagTypeService.getTagType(new TagTypeKey(tagTypeCode)); }  @RequestMapping(value = TAG_TYPES_URI_PREFIX, method = RequestMethod.POST, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_TAG_TYPES_POST) TagType createTagType(@RequestBody TagTypeCreateRequest request); @RequestMapping(value = TAG_TYPES_URI_PREFIX + "/{tagTypeCode}", method = RequestMethod.DELETE) @Secured(SecurityFunctions.FN_TAG_TYPES_DELETE) TagType deleteTagType(@PathVariable("tagTypeCode") String tagTypeCode); @RequestMapping(value = TAG_TYPES_URI_PREFIX + "/{tagTypeCode}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_TAG_TYPES_GET) TagType getTagType(@PathVariable("tagTypeCode") String tagTypeCode); @RequestMapping(value = TAG_TYPES_URI_PREFIX, method = RequestMethod.GET) @Secured(SecurityFunctions.FN_TAG_TYPES_ALL_GET) TagTypeKeys getTagTypes(); @RequestMapping(value = TAG_TYPES_URI_PREFIX + "/search", method = RequestMethod.POST, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_TAG_TYPES_SEARCH_POST) TagTypeSearchResponse searchTagTypes(@RequestBody TagTypeSearchRequest request,
        @RequestParam(value = "fields", required = false, defaultValue = "") Set<String> fields); @RequestMapping(value = TAG_TYPES_URI_PREFIX + "/{tagTypeCode}", method = RequestMethod.PUT, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_TAG_TYPES_PUT) TagType updateTagType(@PathVariable("tagTypeCode") String tagTypeCode, @RequestBody TagTypeUpdateRequest request); final static String TAG_TYPES_URI_PREFIX; }
@Test public void testGetTagType() throws Exception { TagTypeKey tagTypeKey = new TagTypeKey(TAG_TYPE); TagType tagType = new TagType(new TagTypeKey(TAG_TYPE), TAG_TYPE_DISPLAY_NAME, TAG_TYPE_ORDER, TAG_TYPE_DESCRIPTION); when(tagTypeService.getTagType(tagTypeKey)).thenReturn(tagType); TagType resultTagType = tagTypeRestController.getTagType(TAG_TYPE); verify(tagTypeService).getTagType(tagTypeKey); verifyNoMoreInteractions(tagTypeService); assertEquals(tagType, resultTagType); }