Search in sources :

Example 61 with UrlResponse

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

the class GenericIntegrationTest method testParamAndWild.

@Test
public void testParamAndWild() throws Exception {
    UrlResponse response = testUtil.doMethod("GET", "/paramandwild/thedude/stuff/andits", null);
    Assert.assertEquals(200, response.status);
    Assert.assertEquals("paramandwild: thedudeandits", response.body);
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) Test(org.junit.Test)

Example 62 with UrlResponse

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

the class GenericIntegrationTest method testHiHead.

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

Example 63 with UrlResponse

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

the class GenericIntegrationTest method testInheritanceExceptionMapper.

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

Example 64 with UrlResponse

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

the class GenericIntegrationTest method testExternalStaticFile.

@Test
public void testExternalStaticFile() throws Exception {
    UrlResponse response = testUtil.doMethod("GET", "/externalFile.html", null);
    Assert.assertEquals(200, response.status);
    Assert.assertEquals("Content of external file", response.body);
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) Test(org.junit.Test)

Example 65 with UrlResponse

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

the class GenericIntegrationTest method testTypedExceptionMapper.

@Test
public void testTypedExceptionMapper() throws Exception {
    UrlResponse response = testUtil.doMethod("GET", "/throwmeyling", null);
    Assert.assertEquals(new JWGmeligMeylingException().trustButVerify(), response.body);
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) JWGmeligMeylingException(spark.examples.exception.JWGmeligMeylingException) 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