Package com.gargoylesoftware.htmlunit

Examples of com.gargoylesoftware.htmlunit.UnexpectedPage


        webClient = new WebClient();
    }

    @Test
    public void statusCode() throws IOException {
        final UnexpectedPage page = webClient.getPage("http://localhost:8080/test/images/woodstock.jpg");
        final WebResponse response = page.getWebResponse();
        assertEquals(200, response.getStatusCode());
    }
View Full Code Here


        assertEquals(200, response.getStatusCode());
    }

    @Test
    public void contentDisposition() throws IOException {
        final UnexpectedPage page = webClient.getPage("http://localhost:8080/test/images/woodstock.jpg");
        final WebResponse response = page.getWebResponse();
        assertEquals("inline; filename=\"woodstock.jpg\"", response.getResponseHeaderValue("Content-Disposition"));
        webClient.closeAllWindows();
    }
View Full Code Here

        webClient.closeAllWindows();
    }

    @Test
    public void contentType() throws IOException {
        final UnexpectedPage page = webClient.getPage("http://localhost:8080/test/images/woodstock.jpg");
        final WebResponse response = page.getWebResponse();
        assertEquals("image/jpeg", response.getContentType());
        webClient.closeAllWindows();
    }
View Full Code Here

        webClient.closeAllWindows();
    }

    @Test
    public void contentLength() throws IOException {
        final UnexpectedPage page = webClient.getPage("http://localhost:8080/test/images/woodstock.jpg");
        final WebResponse response = page.getWebResponse();
        assertEquals(8907, Integer.parseInt(response.getResponseHeaderValue("Content-Length")));
        webClient.closeAllWindows();
    }
View Full Code Here

        webClient.closeAllWindows();
    }

    @Test
    public void image() throws IOException {
        final UnexpectedPage page = webClient.getPage("http://localhost:8080/test/images/woodstock.jpg");
        InputStream is = page.getInputStream();
        BufferedImage bi = convertInputStreamToBufferedImage(is);
        assertNotNull(bi);
        assertEquals(263, bi.getHeight());
        assertEquals(192, bi.getWidth());
        assertEquals(BufferedImage.TYPE_3BYTE_BGR, bi.getType());
View Full Code Here

TOP

Related Classes of com.gargoylesoftware.htmlunit.UnexpectedPage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.