ViafService implements IService { @Override public List<ISearchResult> search(String word) { List<Item> items = null; String fullUrl; fullUrl = viafURL.trim() + searchViafURLPath.trim() + " " + word.trim() + searchViafURLPath1.trim() + IService.STARTINDEX.trim() + searchViafURLPath2.trim(); ViafReply rep = (ViafReply) restTemplate.getForObject(fullUrl, ViafReply.class); items = rep.getChannel().getItems(); List<ISearchResult> searchResults = new ArrayList<ISearchResult>(); for(Item i : items) { ISearchResult searchResult = new SearchResult(); searchResult.setDescription(i.getPubDate()); searchResult.setId(i.getLink()); searchResult.setName(i.getTitle()); searchResults.add(searchResult); } return searchResults; }  @Override String getServiceId(); @Override String getName(); @Override List<ISearchResult> search(String word);  }
@Test public void testSearch() { List<ISearchResult> searchResults = viafService.search("Pirckheimer"); ISearchResult searchResult = new SearchResult(); searchResult .setDescription("Mon, 12 Jul 2015 18:51:56 GMT"); searchResult.setId("http: searchResult.setName("Pirckheimer, Willibald, 1470-1530."); assertEquals(1, searchResults.size()); assertEquals(searchResult, searchResults.get(0)); }