Search in sources :

Example 1 with RsPrint

use of org.takes.rs.RsPrint 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']"));
}
Also used : Take(org.takes.Take) FkBase(io.wring.fake.FkBase) RqFake(org.takes.rq.RqFake) RsPrint(org.takes.rs.RsPrint) RqWithHeaders(org.takes.rq.RqWithHeaders) Test(org.junit.Test)

Example 2 with RsPrint

use of org.takes.rs.RsPrint 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"));
}
Also used : Take(org.takes.Take) FkBase(io.wring.fake.FkBase) RqFake(org.takes.rq.RqFake) RsPrint(org.takes.rs.RsPrint) RqWithHeader(org.takes.rq.RqWithHeader) Test(org.junit.Test)

Example 3 with RsPrint

use of org.takes.rs.RsPrint 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());
}
Also used : Take(org.takes.Take) FkBase(io.wring.fake.FkBase) RqFake(org.takes.rq.RqFake) RsPrint(org.takes.rs.RsPrint) Test(org.junit.Test)

Example 4 with RsPrint

use of org.takes.rs.RsPrint in project wring by yegor256.

the class TkIndexTest method rendersHomePage.

/**
 * TkHome can render home page.
 * @throws Exception If some problem inside
 */
@Test
public void rendersHomePage() throws Exception {
    final Take take = new TkIndex(new FkBase());
    MatcherAssert.assertThat(XhtmlMatchers.xhtml(new RsPrint(take.act(new RqWithHeader(new RqFake("GET", "/"), "Accept", "text/xml"))).printBody()), XhtmlMatchers.hasXPaths("/page/millis", "/page/links/link[@rel='takes:github']", "/page/total"));
}
Also used : Take(org.takes.Take) FkBase(io.wring.fake.FkBase) RqFake(org.takes.rq.RqFake) RsPrint(org.takes.rs.RsPrint) RqWithHeader(org.takes.rq.RqWithHeader) Test(org.junit.Test)

Aggregations

FkBase (io.wring.fake.FkBase)4 Test (org.junit.Test)4 Take (org.takes.Take)4 RqFake (org.takes.rq.RqFake)4 RsPrint (org.takes.rs.RsPrint)4 RqWithHeader (org.takes.rq.RqWithHeader)2 RqWithHeaders (org.takes.rq.RqWithHeaders)1