Package guide

Source Code of guide.AutodiscoveryOfStubsContentTest

package guide;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.jayway.restassured.RestAssured;

import com.xebialabs.restito.server.StubServer;

import static com.jayway.restassured.RestAssured.expect;
import static com.xebialabs.restito.builder.stub.StubHttp.whenHttp;
import static com.xebialabs.restito.semantics.Action.ok;
import static com.xebialabs.restito.semantics.Action.success;
import static com.xebialabs.restito.semantics.Condition.get;
import static org.hamcrest.Matchers.containsString;

public class AutodiscoveryOfStubsContentTest {

    private StubServer server;

    @Before
    public void start() {
        server = new StubServer().run();
        RestAssured.port = server.getPort();
    }

    @After
    public void stop() {
        server.stop();
    }

    @Test
    public void shouldFindXmlResourceFileByUrl() {
        whenHttp(server).
                match(get("/demo/path%20to%20data/data")).then(ok());

        expect().content(containsString("from data.xml")).when().get("/demo/path to data/data");
    }

}
TOP

Related Classes of guide.AutodiscoveryOfStubsContentTest

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.