Package com.github.kevinsawicki.http

Examples of com.github.kevinsawicki.http.HttpRequest$CloseOperation


        Factory.LocalMachines.threadLocal().clear();
    }

    @Test
    public void should_return_content() throws Exception {
        HttpRequest httpRequest = server.client().authenticatedAs("admin").GET("/api/optional/hasContent");
        assertThat(httpRequest.code()).isEqualTo(200);
        assertThat(httpRequest.body().trim()).isEqualTo("hello");
    }
View Full Code Here


        assertThat(httpRequest.body().trim()).isEqualTo("hello");
    }

    @Test
    public void should_return_not_found() throws Exception {
        HttpRequest httpRequest = server.client().authenticatedAs("admin").GET("/api/optional/isEmpty");
        assertThat(httpRequest.code()).isEqualTo(404);
    }
View Full Code Here

        assertThat(httpRequest.code()).isEqualTo(404);
    }

    @Test
    public void should_return_optional_parameter() throws Exception {
        HttpRequest httpRequest = server.client().authenticatedAs("admin").GET("/api/optional/optionalParam");
        assertThat(httpRequest.code()).isEqualTo(404);
        httpRequest = server.client().authenticatedAs("admin").GET("/api/optional/optionalParam?param=hello");
        assertThat(httpRequest.code()).isEqualTo(200);
        assertThat(httpRequest.body().trim()).isEqualTo("hello");
    }
View Full Code Here

        Factory.LocalMachines.threadLocal().clear();
    }

    @Test
    public void should_not_find_key1() throws Exception {
        HttpRequest httpRequest = server.client().authenticatedAs("admin").GET("/api/optional/settings/key1");
        assertThat(httpRequest.code()).isEqualTo(404);
    }
View Full Code Here

        assertThat(httpRequest.code()).isEqualTo(404);
    }

    @Test
    public void should_find_key2() throws Exception {
        HttpRequest httpRequest = server.client().authenticatedAs("admin").GET("/api/optional/settings/key2");
        assertThat(httpRequest.code()).isEqualTo(200);
        assertThat(httpRequest.body().trim()).isEqualTo("key2");
    }
View Full Code Here

        Factory.LocalMachines.threadLocal().clear();
    }

    @Test
    public void should_not_find_foo() throws Exception {
        HttpRequest httpRequest = server.client().authenticatedAs("admin").GET("/api/optional/dependency/foo");
        assertThat(httpRequest.code()).isEqualTo(200);
        assertThat(httpRequest.body()).isEqualTo("false");
    }
View Full Code Here

        assertThat(httpRequest.body()).isEqualTo("false");
    }

    @Test
    public void should_find_bar() throws Exception {
        HttpRequest httpRequest = server.client().authenticatedAs("admin").GET("/api/optional/dependency/bar");
        assertThat(httpRequest.code()).isEqualTo(200);
        assertThat(httpRequest.body()).isEqualTo("true");
    }
View Full Code Here

    @ClassRule
    public static RestxServerRule server = new RestxServerRule();

    @Test
    public void should_retrieve_details_view() throws Exception {
        HttpRequest httpRequest = server.client().GET("/api/jacksonviews/carsDetails");
        assertThat(httpRequest.code()).isEqualTo(200);
        assertThat(httpRequest.body().trim()).isEqualTo(
                "[ {\n" +
                        "  \"brand\" : \"Brand1\",\n" +
                        "  \"model\" : \"samplest-Model1\",\n" +
                        "  \"status\" : {\n" +
                        "    \"status\" : \"ko\",\n" +
View Full Code Here

                        "  \"details\" : \"Detail2\"\n" +
                        "} ]");
    }
    @Test
    public void should_retrieve_default_view() throws Exception {
        HttpRequest httpRequest = server.client().GET("/api/jacksonviews/cars");
        assertThat(httpRequest.code()).isEqualTo(200);
        assertThat(httpRequest.body().trim()).isEqualTo(
                "[ {\n" +
                        "  \"brand\" : \"Brand1\",\n" +
                        "  \"model\" : \"samplest-Model1\",\n" +
                        "  \"status\" : {\n" +
                        "    \"status\" : \"ko\"\n" +
View Full Code Here

    @ClassRule
    public static RestxServerRule server = new RestxServerRule();

    @Test
    public void should_access_keys() throws Exception {
        HttpRequest httpRequest = server.client().GET(
                "/api/settings/key1");
        assertThat(httpRequest.code()).isEqualTo(200);
        assertThat(httpRequest.body().trim()).isEqualTo("value1");

        httpRequest = server.client().GET(
                "/api/settings/key2");
        assertThat(httpRequest.code()).isEqualTo(200);
        assertThat(httpRequest.body().trim()).isEqualTo("value2");

        httpRequest = server.client().GET(
                "/api/settings/key3");
        assertThat(httpRequest.code()).isEqualTo(200);
        assertThat(httpRequest.body().trim()).isEqualTo("MyValue3");
    }
View Full Code Here

TOP

Related Classes of com.github.kevinsawicki.http.HttpRequest$CloseOperation

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.