Package ign.middleman.helpers

Examples of ign.middleman.helpers.WebResponse


    }

    @Test
    public void notFoundTestWithListener() throws IOException {
        WebClient wc = new WebClient();
        WebResponse wr = wc.raw("GET", "http://localhost:" + port + "/not-found", null, new SimpleWebClientListener());
        assertEquals(404, wr.getStatus());
        assertEquals("Not Found", wr.getMessage());
        assertEquals("text/html; charset=utf-8", wr.getHeaders().get("Content-Type").get(0));
        assertEquals("Hello World", new String(wr.getBody()));

    }
View Full Code Here


    }

    @Test
    public void clientError() throws IOException {
        WebClient wc = new WebClient();
        WebResponse wr = wc.raw("GET", "http://localhost:" + port + "/client-error", null, null);
       
        assertEquals(400, wr.getStatus());

    }
View Full Code Here

    }

    @Test
    public void clientErrorTestWithListener() throws IOException {
        WebClient wc = new WebClient();
        WebResponse wr = wc.raw("GET", "http://localhost:" + port + "/client-error", null, new SimpleWebClientListener());
        assertEquals(400, wr.getStatus());

    }
View Full Code Here

    }

    @Test
    public void serverError() throws IOException {
        WebClient wc = new WebClient();
        WebResponse wr = wc.raw("GET", "http://localhost:" + port + "/server-error", null, null);
        assertEquals(503, wr.getStatus());

    }
View Full Code Here

    }

    @Test
    public void serverErrorTestWithListener() throws IOException {
        WebClient wc = new WebClient();
        WebResponse wr = wc.raw("GET", "http://localhost:" + port + "/server-error", null, new SimpleWebClientListener());
        assertEquals(503, wr.getStatus());

    }
View Full Code Here


    @Test
    public void slowServerTest() throws IOException {
        WebClient wc = new WebClient(5, 5);
        WebResponse wr = wc.raw("GET", "http://localhost:" + port + "/slow", null, null);
        assertEquals(0, wr.getStatus());

    }
View Full Code Here

    }

    @Test
    public void slowServerTestWithListener() throws IOException {
        WebClient wc = new WebClient(5, 5);
        WebResponse wr = wc.raw("GET", "http://localhost:" + port + "/slow", null, new SimpleWebClientListener() {
           

            @Override
            public void onException(Exception e, String error) {
                super.onException(e, error);
View Full Code Here

TOP

Related Classes of ign.middleman.helpers.WebResponse

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.