Search in sources :

Example 16 with UrlResponse

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

the class GenericSecureIntegrationTest method testPost.

@Test
public void testPost() throws Exception {
    UrlResponse response = testUtil.doMethodSecure("POST", "/poster", "Fo shizzy");
    LOGGER.info(response.body);
    Assert.assertEquals(201, response.status);
    Assert.assertTrue(response.body.contains("Fo shizzy"));
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) Test(org.junit.Test)

Example 17 with UrlResponse

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

the class GenericIntegrationTest method testPatch.

@Test
public void testPatch() throws Exception {
    UrlResponse response = testUtil.doMethod("PATCH", "/patcher", "Fo shizzy");
    LOGGER.info(response.body);
    Assert.assertEquals(200, response.status);
    Assert.assertTrue(response.body.contains("Fo shizzy"));
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) Test(org.junit.Test)

Example 18 with UrlResponse

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

the class GenericIntegrationTest method testGetRoot.

@Test
public void testGetRoot() throws Exception {
    UrlResponse response = testUtil.doMethod("GET", "/", null);
    Assert.assertEquals(200, response.status);
    Assert.assertEquals("Hello Root!", response.body);
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) Test(org.junit.Test)

Example 19 with UrlResponse

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

the class GenericIntegrationTest method paths_should_be_very_nestable.

@Test
public void paths_should_be_very_nestable() throws Exception {
    UrlResponse response = testUtil.doMethod("GET", "/firstPath/secondPath/thirdPath/test", null, "application/json");
    Assert.assertTrue(response.status == 200);
    Assert.assertEquals("Very nested path-prefix works", response.body);
    Assert.assertEquals("true", response.headers.get("before-filter-ran"));
}
Also used : UrlResponse(spark.util.SparkTestUtil.UrlResponse) Test(org.junit.Test)

Example 20 with UrlResponse

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

the class GenericIntegrationTest method testEchoParamWithUpperCaseInValue.

@Test
public void testEchoParamWithUpperCaseInValue() throws Exception {
    final String camelCased = "ThisIsAValueAndSparkShouldRetainItsUpperCasedCharacters";
    UrlResponse response = testUtil.doMethod("GET", "/param/" + camelCased, null);
    Assert.assertEquals(200, response.status);
    Assert.assertEquals("echo: " + camelCased, 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