Exemplo n.º 1
0
 public boolean htmlContains(String subString) throws Exception {
   String html = requester.html();
   html = html.replaceAll("\n", " ");
   html = html.replaceAll("\r", " ");
   html = html.replaceAll("\\s+", " ");
   return (html.indexOf(subString) != -1);
 }
Exemplo n.º 2
0
 public boolean containsJsonPacket(String packet) throws Exception {
   packet = ResponseExaminer.convertBreaksToLineSeparators(packet);
   System.out.println("packet = " + packet);
   JSONObject expected = new JSONObject(packet);
   String contentString = requester.contents();
   int jsonStart = contentString.indexOf("{");
   if (jsonStart == -1) return false;
   contentString = contentString.substring(jsonStart);
   System.out.println("contentString = " + contentString);
   JSONObject actual = new JSONObject(contentString);
   return expected.toString(1).equals(actual.toString(1));
 }
Exemplo n.º 3
0
 public String content() throws Exception {
   return requester.html();
 }
Exemplo n.º 4
0
 public int requestPage(String uri) throws Exception {
   requester.uri = uri;
   requester.execute();
   return requester.status();
 }