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); }
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)); }
public String content() throws Exception { return requester.html(); }
public int requestPage(String uri) throws Exception { requester.uri = uri; requester.execute(); return requester.status(); }