Search in sources :

Example 51 with UrlResponse

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

the class GenericIntegrationTest method testGetHiAfterFilter.

@Test
public void testGetHiAfterFilter() throws Exception {
    UrlResponse response = testUtil.doMethod("GET", "/hi", null);
    Assert.assertTrue(response.headers.get("after").contains("foobar"));
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) Test(org.junit.Test)

Example 52 with UrlResponse

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

the class GenericIntegrationTest method testExceptionMapper.

@Test
public void testExceptionMapper() throws Exception {
    UrlResponse response = testUtil.doMethod("GET", "/throwexception", null);
    Assert.assertEquals("Exception handled", response.body);
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) Test(org.junit.Test)

Example 53 with UrlResponse

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

the class GenericIntegrationTest method testRuntimeExceptionForDone.

@Test
public void testRuntimeExceptionForDone() throws Exception {
    UrlResponse response = testUtil.doMethod("GET", "/exception", null);
    Assert.assertEquals("done executed for exception", response.body);
    Assert.assertEquals(500, response.status);
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) Test(org.junit.Test)

Example 54 with UrlResponse

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

the class GenericIntegrationTest method testEchoParam1.

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

Example 55 with UrlResponse

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

the class GenericIntegrationTest method testNotFoundExceptionMapper.

@Test
public void testNotFoundExceptionMapper() throws Exception {
    // thrownotfound
    UrlResponse response = testUtil.doMethod("GET", "/thrownotfound", null);
    Assert.assertEquals(NOT_FOUND_BRO, response.body);
    Assert.assertEquals(404, response.status);
}
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