use of org.takes.Take 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");
});
}
use of org.takes.Take in project wring by yegor256.
the class TkAppTest method rendersHomePage.
/**
* App can render front page.
* @throws Exception If some problem inside
*/
@Test
public void rendersHomePage() throws Exception {
final Take take = new TkApp(new FkBase());
MatcherAssert.assertThat(XhtmlMatchers.xhtml(new RsPrint(take.act(new RqWithHeaders(new RqFake("GET", "/"), "Accept: text/xml"))).printBody()), XhtmlMatchers.hasXPaths("/page/millis", "/page/links/link[@rel='takes:github']"));
}
use of org.takes.Take in project wring by yegor256.
the class TkAppTest method rendersAllPossibleUrls.
/**
* App can render all possible URLs.
* @throws Exception If some problem inside
*/
@Test
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
public void rendersAllPossibleUrls() throws Exception {
final Take take = new TkApp(new FkBase());
final String[] uris = { "/?x=y", "/robots.txt", "/xsl/layout.xsl", "/css/main.css", "/images/logo.svg", "/images/logo.png" };
for (final String uri : uris) {
MatcherAssert.assertThat(uri, take.act(new RqFake("INFO", uri)), Matchers.not(new HmRsStatus(HttpURLConnection.HTTP_NOT_FOUND)));
}
}
use of org.takes.Take in project wring by yegor256.
the class TkEventsTest method rendersListOfEvents.
/**
* TkEvents can render list of events.
* @throws Exception If some problem inside
*/
@Test
public void rendersListOfEvents() throws Exception {
final Take take = new TkAppAuth(new TkEvents(new FkBase()));
MatcherAssert.assertThat(XhtmlMatchers.xhtml(new RsPrint(take.act(new RqWithHeader(new RqFake("GET", "/"), "Accept", "text/xml"))).printBody()), XhtmlMatchers.hasXPaths("/page/millis", "/page/events/event", "/page/events/@total"));
}
use of org.takes.Take in project wring by yegor256.
the class TkFaviconTest method rendersIcon.
/**
* TkFavicon can render home page.
* @throws Exception If some problem inside
*/
@Test
public void rendersIcon() throws Exception {
final Take take = new TkAppAuth(new TkFavicon(new FkBase()));
MatcherAssert.assertThat(new RsPrint(take.act(new RqFake())).printBody(), Matchers.notNullValue());
}
Aggregations