Code example for HttpGet

0
   @RunAsClient 
   @Test 
   public void servletDatasourceInjectionTest(){ 
      DefaultHttpClient httpclient = new DefaultHttpClient();
      HttpResponse response;
      HttpGet httpget = new HttpGet(baseURL.toString());
 
      String responseText;
      try { 
         response = httpclient.execute(httpget);
         HttpEntity entity = response.getEntity();
         responseText = EntityUtils.toString(entity);
      } catch (IOException ex) {
         throw new RuntimeException("No response from servlet!", ex);
      } 
 
      assertTrue("Masked datasource not injected correctly to the servlet! Servlet response text: " + responseText, responseText.contains("true"));
   } 
 
}