public static void assertPing(String message,String expectedContent,URL pingURL,Map<String,String> requestProperties,boolean expectTrue,Logger errorLogger){
  HttpUtils httpUtils=new HttpUtils();
  httpUtils.setLogger(errorLogger);
  HttpUtils.HttpResult result=new HttpUtils.HttpResult();
  boolean success=httpUtils.ping(pingURL,requestProperties,result,PingUtils.TIMEOUT);
  String text=message + ". Failed to ping [" + pingURL.toString()+ "], ";
  if (result.responseCode == -1) {
    text=text + "Cannot connect to the URL";
  }
 else {
    text=text + "Reason = [" + result.responseMessage+ "], Body = ["+ result.responseBody+ "], Code = ["+ result.responseCode+ "]";
  }
  if (expectTrue) {
    assertTrue(text,success);
  }
 else {
    assertFalse(text,success);
  }
  if (expectedContent != null) {
    String content=result.responseBody;
    assertNotNull("result.responseBody is null",content);
    assertTrue(content + " does not contain " + expectedContent,content.contains(expectedContent));
  }
}

public static void assertPing ( String message , String expectedContent , URL pingURL , Map < String , String > requestProperties , boolean expectTrue , Logger errorLogger ) { HttpUtils httpUtils = new HttpUtils ( ) ; httpUtils . setLogger ( errorLogger ) ; HttpUtils . HttpResult result = new HttpUtils . HttpResult ( ) ; boolean success = httpUtils . ping ( pingURL , requestProperties , result , PingUtils . TIMEOUT ) ; String text = message + ". Failed to ping [" + pingURL . toString ( ) + "], " ; if ( result . responseCode == - 1 ) { text = text + "Cannot connect to the URL" ; } else { text = text + "Reason = [" + result . responseMessage + "], Body = [" + result . responseBody + "], Code = [" + result . responseCode + "]" ; } if ( expectTrue ) { assertTrue ( text , success ) ; } else { assertFalse ( text , success ) ; } if ( expectedContent != null ) { String content = result . responseBody ; assertNotNull ( "result.responseBody is null" , content ) ; assertTrue ( content + " does not contain " + expectedContent , content . contains ( expectedContent ) ) ; } }
ping a container and check the result .
