Package restx

Source Code of restx.ResourcesRouteTest

package restx;

import com.github.kevinsawicki.http.HttpRequest;
import org.assertj.core.api.Assertions;
import org.junit.Rule;
import org.junit.Test;
import restx.tests.RestxServerRule;

import java.io.IOException;

import static restx.server.JettyWebServer.jettyWebServerSupplier;

/**
* @author fcamblor
*/
public class ResourcesRouteTest {

    @Rule
    public RestxServerRule restxServer = new RestxServerRule(
            jettyWebServerSupplier("src/test/webapp/WEB-INF/web.xml", "src/test/webapp") );

    @Test
    public void should_static_content_be_served_from_classpath() throws IOException {
        HttpRequest httpRequest = HttpRequest.get(restxServer.getServer().baseUrl() + "/web/hello.txt");

        Assertions.assertThat(httpRequest.code()).isEqualTo(200);
        Assertions.assertThat(httpRequest.body().trim()).isEqualTo("Hello world !");
    }
}
TOP

Related Classes of restx.ResourcesRouteTest

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.