Search in sources :

Example 1 with FtRemote

use of org.takes.http.FtRemote in project wring by yegor256.

the class TkAppTest method rendersHomePageViaHttp.

/**
 * App can render front page.
 * @throws Exception If some problem inside
 */
@Test
public void rendersHomePageViaHttp() throws Exception {
    final Take app = new TkApp(new FkBase());
    new FtRemote(app).exec(home -> {
        new JdkRequest(home).fetch().as(RestResponse.class).assertStatus(HttpURLConnection.HTTP_OK).as(XmlResponse.class).assertXPath("/xhtml:html");
        new JdkRequest(home).through(VerboseWire.class).header("Accept", "application/xml").fetch().as(RestResponse.class).assertStatus(HttpURLConnection.HTTP_OK).as(XmlResponse.class).assertXPath("/page/version");
    });
}
Also used : Take(org.takes.Take) FkBase(io.wring.fake.FkBase) FtRemote(org.takes.http.FtRemote) JdkRequest(com.jcabi.http.request.JdkRequest) RestResponse(com.jcabi.http.response.RestResponse) XmlResponse(com.jcabi.http.response.XmlResponse) Test(org.junit.Test)

Aggregations

JdkRequest (com.jcabi.http.request.JdkRequest)1 RestResponse (com.jcabi.http.response.RestResponse)1 XmlResponse (com.jcabi.http.response.XmlResponse)1 FkBase (io.wring.fake.FkBase)1 Test (org.junit.Test)1 Take (org.takes.Take)1 FtRemote (org.takes.http.FtRemote)1