Search in sources :

Example 41 with UrlResponse

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

the class ServletTest method testPost.

@Test
public void testPost() throws Exception {
    UrlResponse response = testUtil.doMethod("POST", SOMEPATH + "/poster", "Fo shizzy");
    Assert.assertEquals(201, response.status);
    Assert.assertTrue(response.body.contains("Fo shizzy"));
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) Test(org.junit.Test)

Example 42 with UrlResponse

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

the class ServletTest method testHiHead.

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

Example 43 with UrlResponse

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

the class ServletTest method testNotFound.

@Test
public void testNotFound() throws Exception {
    UrlResponse urlResponse = testUtil.doMethod("GET", SOMEPATH + "/no/resource", null);
    Assert.assertTrue(urlResponse.status == 404);
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) Test(org.junit.Test)

Example 44 with UrlResponse

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

the class ServletTest method testStaticWelcomeResource.

@Test
public void testStaticWelcomeResource() throws Exception {
    UrlResponse response = testUtil.doMethod("GET", SOMEPATH + "/pages/", null);
    Assert.assertEquals(200, response.status);
    Assert.assertTrue(response.body.contains("<html><body>Hello Static World!</body></html>"));
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) Test(org.junit.Test)

Example 45 with UrlResponse

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

the class ServletTest method testGetRoot.

@Test
public void testGetRoot() throws Exception {
    UrlResponse response = testUtil.doMethod("GET", SOMEPATH + "/", null);
    Assert.assertEquals(200, response.status);
    Assert.assertEquals("Hello Root!", 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