use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.
the class GenericIntegrationTest method routes_should_be_accept_type_aware.
@Test
public void routes_should_be_accept_type_aware() throws Exception {
UrlResponse response = testUtil.doMethod("GET", "/hi", null, "application/json");
Assert.assertEquals(200, response.status);
Assert.assertEquals("{\"message\": \"Hello World\"}", response.body);
}
use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.
the class GenericIntegrationTest method template_view_should_be_rendered_with_given_model_view_object.
@Test
public void template_view_should_be_rendered_with_given_model_view_object() throws Exception {
UrlResponse response = testUtil.doMethod("GET", "/templateView", null);
Assert.assertEquals(200, response.status);
Assert.assertEquals("Hello from my view", response.body);
}
use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.
the class GenericIntegrationTest method testPost.
@Test
public void testPost() throws Exception {
UrlResponse response = testUtil.doMethod("POST", "/poster", "Fo shizzy");
LOGGER.info(response.body);
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 GenericIntegrationTest method path_should_prefix_routes.
@Test
public void path_should_prefix_routes() throws Exception {
UrlResponse response = testUtil.doMethod("GET", "/firstPath/test", null, "application/json");
Assert.assertTrue(response.status == 200);
Assert.assertEquals("Single path-prefix works", response.body);
Assert.assertEquals("true", response.headers.get("before-filter-ran"));
}
use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.
the class GenericIntegrationTest method testEchoParam2.
@Test
public void testEchoParam2() throws Exception {
UrlResponse response = testUtil.doMethod("GET", "/param/gunit", null);
Assert.assertEquals(200, response.status);
Assert.assertEquals("echo: gunit", response.body);
}
Aggregations