Exemplo n.º 1
0
 /** @throws Exception if the test fails */
 @Test
 public void getWebResponse() throws Exception {
   final HtmlImage htmlimage = getHtmlElementToTest("image1");
   final URL url = htmlimage.getPage().getWebResponse().getWebRequest().getUrl();
   Assert.assertNull(htmlimage.getWebResponse(false));
   final WebResponse resp = htmlimage.getWebResponse(true);
   Assert.assertNotNull(resp);
   assertEquals(url.toExternalForm(), resp.getWebRequest().getAdditionalHeaders().get("Referer"));
 }
Exemplo n.º 2
0
 /** @throws Exception if the test fails */
 @Test
 public void imageFileSize() throws Exception {
   final HtmlImage htmlimage = getHtmlElementToTest("image1");
   Assert.assertEquals(
       "Image filesize",
       140144,
       IOUtils.toByteArray(htmlimage.getWebResponse(true).getContentAsStream()).length);
 }