Search in sources :

Example 46 with UrlResponse

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);
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) Test(org.junit.Test)

Example 47 with UrlResponse

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);
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) Test(org.junit.Test)

Example 48 with UrlResponse

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);
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) Test(org.junit.Test)

Example 49 with UrlResponse

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);
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) Test(org.junit.Test)

Example 50 with UrlResponse

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