DuckDuckGoAgent extends AbstractAgent { protected static String createUrl(String entity) { try { entity = URLEncoder.encode(entity, "UTF-8"); } catch (UnsupportedEncodingException e) { logger.error("Unexpected exception when encoding url", e); } return "http: } DuckDuckGoAgent(HttpClient client); @Override AgentResponse process(AgentRequest request);  }
@Test public void testUrlEncoding() { String urlBase = "http: assertEquals(urlBase + "Barack+Obama", DuckDuckGoAgent.createUrl("Barack Obama")); }