@Test public void getSuggestionsTest2() { final String EXPECTED_RESPONSE_BODY = "{\"query\":\"panda\",\"suggestions\":[]}"; mockTransport = MockHelper.makeMockHttpTransport(EXPECTED_RESPONSE_BODY); handler = new MedAutoCompleteHandler(mockTransport); List<String> expected = Collections.emptyList(); List<String> actual = handler.getSuggestions("panda"); assertEquals(expected, actual); }
public List<String> getSuggestions(String queryString) { List<String> suggestions = new ArrayList<>(); try { MedAutoCompleteURL url = new MedAutoCompleteURL(AUTOCOMPLETE_ENDPOINT); url.setQueryString(queryString); HttpRequest request = requestFactory.buildGetRequest(url); suggestions = request.execute().parseAs(MedAutoCompleteResponse.class).getSuggestions(); } catch (IOException e) { LOGGER.log(Level.INFO, e.getMessage(), e); } return suggestions; }
MedAutoCompleteHandler extends WebAPIHandler { public List<String> getSuggestions(String queryString) { List<String> suggestions = new ArrayList<>(); try { MedAutoCompleteURL url = new MedAutoCompleteURL(AUTOCOMPLETE_ENDPOINT); url.setQueryString(queryString); HttpRequest request = requestFactory.buildGetRequest(url); suggestions = request.execute().parseAs(MedAutoCompleteResponse.class).getSuggestions(); } catch (IOException e) { LOGGER.log(Level.INFO, e.getMessage(), e); } return suggestions; } }
MedAutoCompleteHandler extends WebAPIHandler { public List<String> getSuggestions(String queryString) { List<String> suggestions = new ArrayList<>(); try { MedAutoCompleteURL url = new MedAutoCompleteURL(AUTOCOMPLETE_ENDPOINT); url.setQueryString(queryString); HttpRequest request = requestFactory.buildGetRequest(url); suggestions = request.execute().parseAs(MedAutoCompleteResponse.class).getSuggestions(); } catch (IOException e) { LOGGER.log(Level.INFO, e.getMessage(), e); } return suggestions; } MedAutoCompleteHandler();  MedAutoCompleteHandler(HttpTransport transport); }
MedAutoCompleteHandler extends WebAPIHandler { public List<String> getSuggestions(String queryString) { List<String> suggestions = new ArrayList<>(); try { MedAutoCompleteURL url = new MedAutoCompleteURL(AUTOCOMPLETE_ENDPOINT); url.setQueryString(queryString); HttpRequest request = requestFactory.buildGetRequest(url); suggestions = request.execute().parseAs(MedAutoCompleteResponse.class).getSuggestions(); } catch (IOException e) { LOGGER.log(Level.INFO, e.getMessage(), e); } return suggestions; } MedAutoCompleteHandler();  MedAutoCompleteHandler(HttpTransport transport); @Override List<String> getData(Object... arguments); List<String> getSuggestions(String queryString); }
MedAutoCompleteHandler extends WebAPIHandler { public List<String> getSuggestions(String queryString) { List<String> suggestions = new ArrayList<>(); try { MedAutoCompleteURL url = new MedAutoCompleteURL(AUTOCOMPLETE_ENDPOINT); url.setQueryString(queryString); HttpRequest request = requestFactory.buildGetRequest(url); suggestions = request.execute().parseAs(MedAutoCompleteResponse.class).getSuggestions(); } catch (IOException e) { LOGGER.log(Level.INFO, e.getMessage(), e); } return suggestions; } MedAutoCompleteHandler();  MedAutoCompleteHandler(HttpTransport transport); @Override List<String> getData(Object... arguments); List<String> getSuggestions(String queryString);  }