SearchIndexRestController extends HerdBaseController { @RequestMapping(value = SEARCH_INDEXES_URI_PREFIX, method = RequestMethod.GET) @Secured(SecurityFunctions.FN_SEARCH_INDEXES_ALL_GET) public SearchIndexKeys getSearchIndexes() { return searchIndexService.getSearchIndexes(); }  @RequestMapping(value = SEARCH_INDEXES_URI_PREFIX, method = RequestMethod.POST, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_SEARCH_INDEXES_POST) SearchIndex createSearchIndex(@RequestBody SearchIndexCreateRequest request); @RequestMapping(value = SEARCH_INDEXES_URI_PREFIX + "/{searchIndexName}", method = RequestMethod.DELETE) @Secured(SecurityFunctions.FN_SEARCH_INDEXES_DELETE) SearchIndex deleteSearchIndex(@PathVariable("searchIndexName") String searchIndexName); @RequestMapping(value = SEARCH_INDEXES_URI_PREFIX + "/{searchIndexName}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_SEARCH_INDEXES_GET) SearchIndex getSearchIndex(@PathVariable("searchIndexName") String searchIndexName); @RequestMapping(value = SEARCH_INDEXES_URI_PREFIX, method = RequestMethod.GET) @Secured(SecurityFunctions.FN_SEARCH_INDEXES_ALL_GET) SearchIndexKeys getSearchIndexes(); static final String SEARCH_INDEXES_URI_PREFIX; }
@Test public void testGetSearchIndexes() { SearchIndexKeys searchIndexKeys = new SearchIndexKeys(Arrays.asList(new SearchIndexKey(SEARCH_INDEX_NAME), new SearchIndexKey(SEARCH_INDEX_NAME_2))); when(searchIndexService.getSearchIndexes()).thenReturn(searchIndexKeys); SearchIndexKeys response = searchIndexRestController.getSearchIndexes(); verify(searchIndexService, times(1)).getSearchIndexes(); assertEquals(searchIndexKeys, response); }