TagTypeRestController { @RequestMapping(value = TAG_TYPES_URI_PREFIX + "/search", method = RequestMethod.POST, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_TAG_TYPES_SEARCH_POST) public TagTypeSearchResponse searchTagTypes(@RequestBody TagTypeSearchRequest request, @RequestParam(value = "fields", required = false, defaultValue = "") Set<String> fields) { return tagTypeService.searchTagTypes(request, fields); }  @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 testSearchTagTypes() { TagTypeSearchResponse tagTypeSearchResponse = new TagTypeSearchResponse(Arrays .asList(new TagType(new TagTypeKey(TAG_TYPE_2), TAG_TYPE_DISPLAY_NAME_2, TAG_TYPE_ORDER, TAG_TYPE_DESCRIPTION_2), new TagType(new TagTypeKey(TAG_TYPE), TAG_TYPE_DISPLAY_NAME, TAG_TYPE_ORDER_2, TAG_TYPE_DESCRIPTION))); Set<String> searchFields = Sets.newHashSet(TagTypeServiceImpl.DISPLAY_NAME_FIELD, TagTypeServiceImpl.TAG_TYPE_ORDER_FIELD, TagTypeServiceImpl.DESCRIPTION_FIELD); when(tagTypeService.searchTagTypes(new TagTypeSearchRequest(), searchFields)).thenReturn(tagTypeSearchResponse); TagTypeSearchResponse resultTagTypeSearchResponse = tagTypeRestController.searchTagTypes(new TagTypeSearchRequest(), searchFields); verify(tagTypeService).searchTagTypes(new TagTypeSearchRequest(), searchFields); verifyNoMoreInteractions(tagTypeService); assertEquals(tagTypeSearchResponse, resultTagTypeSearchResponse); }