Search in sources :

Example 6 with UrlResponse

use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.

the class ServletTest method testGetHiAfterFilter.

@Test
public void testGetHiAfterFilter() throws Exception {
    UrlResponse response = testUtil.doMethod("GET", SOMEPATH + "/hi", null);
    Assert.assertTrue(response.headers.get("after").contains("foobar"));
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) Test(org.junit.Test)

Example 7 with UrlResponse

use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.

the class ServletTest method testExternalStaticFile.

@Test
public void testExternalStaticFile() throws Exception {
    UrlResponse response = testUtil.doMethod("GET", SOMEPATH + "/" + MyApp.EXTERNAL_FILE, null);
    Assert.assertEquals(200, response.status);
    Assert.assertEquals("Content of external file", response.body);
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) Test(org.junit.Test)

Example 8 with UrlResponse

use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.

the class ServletTest method testStaticResource.

@Test
public void testStaticResource() throws Exception {
    UrlResponse response = testUtil.doMethod("GET", SOMEPATH + "/css/style.css", null);
    Assert.assertEquals(200, response.status);
    Assert.assertTrue(response.body.contains("Content of css file"));
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) Test(org.junit.Test)

Example 9 with UrlResponse

use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.

the class GenericSecureIntegrationTest method testNotFound.

@Test
public void testNotFound() throws Exception {
    UrlResponse urlResponse = testUtil.doMethodSecure("GET", "/no/resource", null);
    Assert.assertTrue(urlResponse.status == 404);
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) Test(org.junit.Test)

Example 10 with UrlResponse

use of spark.util.SparkTestUtil.UrlResponse in project spark by perwendel.

the class GenericSecureIntegrationTest method testGetRoot.

@Test
public void testGetRoot() throws Exception {
    UrlResponse response = testUtil.doMethodSecure("GET", "/", null);
    Assert.assertEquals(200, response.status);
    Assert.assertEquals("Hello Root!", 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