### Question:
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);  }### Answer:
@Test public void getSuggestionsTest1() { final String EXPECTED_RESPONSE_BODY = "{\"query\":\"res\",\"suggestions\":[\"Reserpine\",\"Resectisol\",\"Resec" + "tisol in plastic container\",\"Restoril\",\"Rescriptor\",\"Restasis\",\"Rescula\",\"Reserpine and hy" + "drochlorothiazide\",\"Reserpine, hydralazine hydrochloride and hydrochlorothiazide\",\"Reserpine, hy" + "drochlorothiazide, and hydralazine hydrochloride\",\"Reserpine and hydrochlorothiazide-50\",\"Reserp" + "ine and hydroflumethiazide\",\"Resporal\"]}"; mockTransport = MockHelper.makeMockHttpTransport(EXPECTED_RESPONSE_BODY); handler = new MedAutoCompleteHandler(mockTransport); List<String> expected = Arrays .asList("Reserpine", "Resectisol", "Resectisol in plastic container", "Restoril", "Rescriptor", "Restasis", "Rescula", "Reserpine and hydrochlorothiazide", "Reserpine, hydralazine hydrochloride and hydrochlorothiazide", "Reserpine, hydrochlorothiazide, and hydralazine hydrochloride", "Reserpine and hydrochlorothiazide-50", "Reserpine and hydroflumethiazide", "Resporal"); List<String> actual = handler.getSuggestions("res"); assertEquals(expected, actual); }
@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); }