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"));
}
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);
}
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);
}
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>"));
}
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);
}
Aggregations