use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.
the class ServletTest method testGetHi.
@Test
public void testGetHi() throws Exception {
UrlResponse response = testUtil.doMethod("GET", SOMEPATH + "/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 testEchoParamWithMaj.
@Test
public void testEchoParamWithMaj() throws Exception {
UrlResponse response = testUtil.doMethod("GET", "/paramwithmaj/plop", null);
Assert.assertEquals(200, response.status);
Assert.assertEquals("echo: plop", response.body);
}
use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.
the class GenericIntegrationTest method testUnauthorized.
@Test
public void testUnauthorized() throws Exception {
UrlResponse response = testUtil.doMethod("GET", "/secretcontent/whateva", null);
Assert.assertTrue(response.status == 401);
}
use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.
the class GenericIntegrationTest method testSessionReset.
@Test
public void testSessionReset() throws Exception {
UrlResponse response = testUtil.doMethod("GET", "/session_reset", null);
Assert.assertEquals(200, response.status);
Assert.assertEquals("22222", response.body);
}
use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.
the class GenericIntegrationTest method testParamWithEncodedSlash.
@Test
public void testParamWithEncodedSlash() throws Exception {
String polyglot = "te/st";
String encoded = URLEncoder.encode(polyglot, "UTF-8");
UrlResponse response = testUtil.doMethod("GET", "/param/" + encoded, null);
Assert.assertEquals(200, response.status);
Assert.assertEquals("echo: " + polyglot, response.body);
}
Aggregations