/** * The image should be redownloaded when the src attribute changes. * * @throws Exception if the test fails */ @Test public void redownloadOnSrcAttributeChanged() throws Exception { final HtmlImage htmlimage = getHtmlElementToTest("image1"); final ImageReader imagereader = htmlimage.getImageReader(); htmlimage.setAttribute("src", htmlimage.getAttribute("src") + "#changed"); Assert.assertFalse( "Src attribute changed but ImageReader was not reloaded", imagereader.equals(htmlimage.getImageReader())); }
/** @throws Exception if the test fails */ @Test public void getImageReaderNoneSupportedImage() throws Exception { final HtmlImage htmlimage = getHtmlElementToTest("image1"); final String url = "/HtmlImageDownloadTest.html"; htmlimage.setAttribute("src", url); try { htmlimage.getImageReader(); Assert.fail("it was not an image!"); } catch (final IOException ioe) { // Correct behavior } }
/** @throws Exception if the test fails */ @Test public void getImageReader() throws Exception { final HtmlImage htmlimage = getHtmlElementToTest("image1"); Assert.assertNotNull("ImageReader should not be null", htmlimage.getImageReader()); }