Package spark.util.SparkTestUtil

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


    }

    @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

    }

    @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

        }
    }

    @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

    }

    @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

    }

    @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

    }

    @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

    }

    @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

    }

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

    }

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

TOP

Related Classes of spark.util.SparkTestUtil.UrlResponse

Copyright © 2018 www.massapicom. 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.