Search in sources :

Example 1 with PageCallback

use of org.apache.tapestry5.PageCallback in project tapestry-5 by apache.

the class PageCallbackTest method callback_with_no_context.

@Test
public void callback_with_no_context() {
    PageRenderLinkSource source = mockPageRenderLinkSource();
    Link link = mockLink();
    expect(source.createPageRenderLinkWithContext("foo")).andReturn(link);
    PageCallback pc = new PageCallback("foo");
    assertEquals(pc.toString(), "PageCallback[foo]");
    replay();
    assertSame(pc.toLink(source), link);
    verify();
}
Also used : PageRenderLinkSource(org.apache.tapestry5.services.PageRenderLinkSource) PageCallback(org.apache.tapestry5.PageCallback) Link(org.apache.tapestry5.http.Link) Test(org.testng.annotations.Test)

Example 2 with PageCallback

use of org.apache.tapestry5.PageCallback in project tapestry-5 by apache.

the class PageCallbackTest method callback_with_context.

@Test
public void callback_with_context() {
    EventContext context = new ArrayEventContext(typeCoercer, 1, 2);
    PageRenderLinkSource source = mockPageRenderLinkSource();
    Link link = mockLink();
    expect(source.createPageRenderLinkWithContext("bar", "1", "2")).andReturn(link);
    PageCallback pc = new PageCallback("bar", context);
    assertEquals(pc.toString(), "PageCallback[bar 1/2]");
    replay();
    assertSame(pc.toLink(source), link);
    verify();
}
Also used : ArrayEventContext(org.apache.tapestry5.internal.services.ArrayEventContext) EventContext(org.apache.tapestry5.EventContext) ArrayEventContext(org.apache.tapestry5.internal.services.ArrayEventContext) PageRenderLinkSource(org.apache.tapestry5.services.PageRenderLinkSource) PageCallback(org.apache.tapestry5.PageCallback) Link(org.apache.tapestry5.http.Link) Test(org.testng.annotations.Test)

Aggregations

PageCallback (org.apache.tapestry5.PageCallback)2 Link (org.apache.tapestry5.http.Link)2 PageRenderLinkSource (org.apache.tapestry5.services.PageRenderLinkSource)2 Test (org.testng.annotations.Test)2 EventContext (org.apache.tapestry5.EventContext)1 ArrayEventContext (org.apache.tapestry5.internal.services.ArrayEventContext)1