Search in sources :

Example 1 with UrlResponse

use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.

the class FilterTest method testJustFilter.

@Test
public void testJustFilter() throws Exception {
    UrlResponse response = testUtil.doMethod("GET", "/justfilter", null);
    System.out.println("response.status = " + response.status);
    Assert.assertEquals(404, response.status);
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) Test(org.junit.Test)

Example 2 with UrlResponse

use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.

the class GenericIntegrationTest method testGetInputStreamHi.

@Test
public void testGetInputStreamHi() {
    try {
        UrlResponse response = testUtil.doMethod("GET", "/inputstreamhi", null);
        Assert.assertEquals(200, response.status);
        Assert.assertEquals("Hello World!", response.body);
    } catch (Throwable e) {
        throw new RuntimeException(e);
    }
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) Test(org.junit.Test)

Example 3 with UrlResponse

use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.

the class ResponseWrapperDelegationTest method filters_can_detect_response_status.

@Test
public void filters_can_detect_response_status() throws Exception {
    UrlResponse response = testUtil.get("/204");
    Assert.assertEquals(200, response.status);
    Assert.assertEquals("ok", response.body);
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) Test(org.junit.Test)

Example 4 with UrlResponse

use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.

the class ResponseWrapperDelegationTest method filters_can_detect_content_type.

@Test
public void filters_can_detect_content_type() throws Exception {
    UrlResponse response = testUtil.get("/json");
    Assert.assertEquals(200, response.status);
    Assert.assertEquals("{\"status\": \"ok\"}", response.body);
    Assert.assertEquals("text/plain", response.headers.get("Content-Type"));
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) Test(org.junit.Test)

Example 5 with UrlResponse

use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.

the class ServletTest method testEchoParam2.

@Test
public void testEchoParam2() throws Exception {
    UrlResponse response = testUtil.doMethod("GET", SOMEPATH + "/gunit", null);
    Assert.assertEquals(200, response.status);
    Assert.assertEquals("echo: gunit", response.body);
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) Test(org.junit.Test)

Aggregations

UrlResponse (spark.util.SparkTestUtil.UrlResponse)66 Test (org.junit.Test)65 HashMap (java.util.HashMap)3 JWGmeligMeylingException (spark.examples.exception.JWGmeligMeylingException)1