Package com.googlecode.utterlyidle

Examples of com.googlecode.utterlyidle.Response


        console.shutdown();
    }

    @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


                        .add("logs", asList(model().add("message", "java.lang.Integer life = 42").add("type", "SUCCESS")))));
    }

    @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)));
    }
View Full Code Here

    public void shouldReturnCompletions() throws Exception {
        client.handle(post(url("execute")).form("expression", "expr_1 = 42").build());
        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

    @Test
    public void shouldReturnHistory() throws Exception {
        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"))));
    }
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

            return "[unknown]";
        }
    }

    public synchronized Sequence<String> history() throws Exception {
        Response history = client.handle(get(url("history")).build());
        Model model = parse(history.entity().toString());
        return sequence(model.getValues("history", String.class));
    }
View Full Code Here

TOP

Related Classes of com.googlecode.utterlyidle.Response

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.