Examples of UrlResponse


Examples of spark.util.SparkTestUtil.UrlResponse

    }

    @Test
    public void testUnauthorized() throws Exception {
        try {
            UrlResponse urlResponse = testUtil.doMethod("GET", SOMEPATH + "/protected/resource", null);
            Assert.assertTrue(urlResponse.status == 401);
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

Examples of spark.util.SparkTestUtil.UrlResponse

    }

    @Test
    public void testNotFound() throws Exception {
        try {
            UrlResponse urlResponse = testUtil.doMethod("GET", SOMEPATH + "/no/resource", null);
            Assert.assertTrue(urlResponse.status == 404);
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

Examples of spark.util.SparkTestUtil.UrlResponse

    }

    @Test
    public void testPost() {
        try {
            UrlResponse response = testUtil.doMethod("POST", SOMEPATH + "/poster", "Fo shizzy");
            Assert.assertEquals(201, response.status);
            Assert.assertTrue(response.body.contains("Fo shizzy"));
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
View Full Code Here

Examples of spark.util.SparkTestUtil.UrlResponse

    }

    @Test
    public void testStaticResource() {
        try {
            UrlResponse response = testUtil.doMethod("GET", SOMEPATH + "/css/style.css", null);
            Assert.assertEquals(200, response.status);
            Assert.assertTrue(response.body.contains("Content of css file"));
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
View Full Code Here

Examples of spark.util.SparkTestUtil.UrlResponse

    }

    @Test
    public void testStaticWelcomeResource() {
        try {
            UrlResponse response = testUtil.doMethod("GET", SOMEPATH + "/pages/", null);
            Assert.assertEquals(200, response.status);
            Assert.assertTrue(response.body.contains("<html><body>Hello Static World!</body></html>"));
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
View Full Code Here

Examples of spark.util.SparkTestUtil.UrlResponse

        }
    }

    @Test
    public void testExternalStaticFile() throws Exception {
        UrlResponse response = testUtil.doMethod("GET", SOMEPATH + "/externalFile.html", null);
        Assert.assertEquals(200, response.status);
        Assert.assertEquals("Content of external file", response.body);
    }
View Full Code Here

Examples of spark.util.SparkTestUtil.UrlResponse

    }

    @Test
    public void testHiHead() {
        try {
            UrlResponse response = testUtil.doMethodSecure("HEAD", "/hi", null);
            Assert.assertEquals(200, response.status);
            Assert.assertEquals("", response.body);
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
View Full Code Here

Examples of spark.util.SparkTestUtil.UrlResponse

    }

    @Test
    public void testGetHiAfterFilter() {
        try {
            UrlResponse response = testUtil.doMethodSecure("GET", "/hi", null);
            Assert.assertTrue(response.headers.get("after").contains("foobar"));
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

Examples of spark.util.SparkTestUtil.UrlResponse

    }

    @Test
    public void testGetRoot() {
        try {
            UrlResponse response = testUtil.doMethodSecure("GET", "/", null);
            Assert.assertEquals(200, response.status);
            Assert.assertEquals("Hello Root!", response.body);
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
View Full Code Here

Examples of spark.util.SparkTestUtil.UrlResponse

    }

    @Test
    public void testEchoParam1() {
        try {
            UrlResponse response = testUtil.doMethodSecure("GET", "/shizzy",
                                                           null);
            Assert.assertEquals(200, response.status);
            Assert.assertEquals("echo: shizzy", response.body);
        } catch (Throwable e) {
            throw new RuntimeException(e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.