use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.
the class GenericIntegrationTest method assertEchoRoute.
private static void assertEchoRoute(String routePart) throws Exception {
final String expected = "expected";
UrlResponse response = testUtil.doMethod("GET", "/tworoutes/" + routePart + "/" + expected, null);
Assert.assertEquals(200, response.status);
Assert.assertEquals(routePart + " route: " + expected, response.body);
}
use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.
the class GenericIntegrationTest method testGetHi.
@Test
public void testGetHi() throws Exception {
UrlResponse response = testUtil.doMethod("GET", "/hi", null);
Assert.assertEquals(200, response.status);
Assert.assertEquals("Hello World!", response.body);
}
use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.
the class GenericIntegrationTest method filters_should_be_accept_type_aware.
@Test
public void filters_should_be_accept_type_aware() throws Exception {
UrlResponse response = testUtil.doMethod("GET", "/protected/resource", null, "application/json");
Assert.assertTrue(response.status == 401);
Assert.assertEquals("{\"message\": \"Go Away!\"}", response.body);
}
use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.
the class GenericIntegrationTest method testPathParamsWithPlusSign.
@Test
public void testPathParamsWithPlusSign() throws Exception {
String pathParamWithPlusSign = "not+broken+path+param";
UrlResponse response = testUtil.doMethod("GET", "/param/" + pathParamWithPlusSign, null);
Assert.assertEquals(200, response.status);
Assert.assertEquals("echo: " + pathParamWithPlusSign, response.body);
}
use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.
the class GenericIntegrationTest method paths_should_be_nestable.
@Test
public void paths_should_be_nestable() throws Exception {
UrlResponse response = testUtil.doMethod("GET", "/firstPath/secondPath/test", null, "application/json");
Assert.assertTrue(response.status == 200);
Assert.assertEquals("Nested path-prefix works", response.body);
Assert.assertEquals("true", response.headers.get("before-filter-ran"));
}
Aggregations