YahooLookup implements LookupProvider { @Override public List<LookupInfo> search(String symbolOrName) throws IOException { YahooLookupModel result = rt.getForObject(format(url, symbolOrName), YahooLookupModel.class); return result.getItems().stream() .map(r -> new LookupInfo(r.getSymbol(), r.getName(), r.getExchDisp(), r.getTypeDisp(), getProviderCode())) .collect(Collectors.toList()); }  @Override List<LookupInfo> search(String symbolOrName); @Override LookupDetails getDetails(String code); @Override String getProviderCode();  }
@Test public void testSearch() throws Exception { server.expect(anything()).andRespond(withSuccess(SEARCH_RESULT, MediaType.APPLICATION_JSON)); List<LookupInfo> result = yahooLookup.search("ubi"); assertThat(result).containsOnlyOnce(new LookupInfo("UBI.PA", "Ubisoft Entertainment SA", "Paris", "Equity", "YAHOO")); }