Package com.googlecode.utterlyidle

Examples of com.googlecode.utterlyidle.Response.status()


    @Test
    public void shouldReturnResultForGivenExpression() throws Exception {
        Response response = client.handle(post(url("execute")).form("expression", "life = 42").build());

        assertThat(response.status(), is(Status.OK));
        assertThat(body(response),
                is(model()
                        .add("expression", "life = 42")
                        .add("logs", asList(model().add("message", "java.lang.Integer life = 42").add("type", "SUCCESS")))));
    }
View Full Code Here


    @Test
    public void shouldReturnTemplate() throws Exception {
        Response response = client.handle(get(url("template")).query("expression", "life = 42").build());

        assertThat(response.status(), is(Status.OK));
        assertThat(body(response).get("template", String.class),
                containsString(body(response).get("token", String.class)));
    }

    @Test
View Full Code Here

        client.handle(post(url("execute")).form("expression", "expr_2 = 21").build());
        client.handle(post(url("execute")).form("expression", "expr_3 = 7").build());

        Response response = client.handle(get(url("completions")).query("expression", "prefix expr_").build());

        assertThat(response.status(), is(Status.OK));
        assertThat(body(response), is(model()
                .add("expression", "prefix expr_")
                .add("position", "7")
                .add("candidates",
                        asList(
View Full Code Here

        client.handle(post(url("execute")).form("expression", "life = 42").build());
        client.handle(post(url("execute")).form("expression", ":help").build());

        Response response = client.handle(get(url("history")).build());

        assertThat(response.status(), is(Status.OK));
        assertThat(body(response), is(model().add("history", asList("life = 42", ":help"))));
    }


    @Test
View Full Code Here

    @Test
    public void shouldReturnCorrectStatus() throws Exception {
        Response response = client.handle(get(url("status")).build());

        assertThat(response.status(), is(Status.OK));
        assertThat(body(response), is(model()
                .add("status", Running.toString())));

    }
View Full Code Here

    @Test
    public void shouldReturnCorrectVersion() throws Exception {
        Response response = client.handle(get(url("version")).build());

        assertThat(response.status(), is(Status.OK));
        assertThat(body(response), is(model()
                .add("version", applicationVersion())));

    }
View Full Code Here

    }

    @Test
    public void shouldReadExpression() throws Exception {
        Response response = client.handle(post(url("readExpression")).form("line", "{").build());
        assertThat(response.status(), is(Status.OK));
        assertThat(body(response), is(model()));

        response = client.handle(post(url("readExpression")).form("line", "}").build());
        assertThat(response.status(), is(Status.OK));
        assertThat(body(response), is(model().add("expression", "{\n}")));
View Full Code Here

        Response response = client.handle(post(url("readExpression")).form("line", "{").build());
        assertThat(response.status(), is(Status.OK));
        assertThat(body(response), is(model()));

        response = client.handle(post(url("readExpression")).form("line", "}").build());
        assertThat(response.status(), is(Status.OK));
        assertThat(body(response), is(model().add("expression", "{\n}")));

    }

    private String url(String url) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.