Object... context)
{
PageActivationContextCollector collector = mockPageActivationContextCollector();
LinkCreationListener listener = mockLinkCreationListener();
LinkFactory factory = mockLinkFactory();
Link link = mockLink();
ComponentClassResolver resolver = mockComponentClassResolver();
String canonical = "CanonicalPageName";
train_canonicalizePageName(resolver, pageName, canonical);
if (!overrideContext)
train_collectPageActivationContext(collector, canonical, context);
PageRenderRequestParameters parameters =
new PageRenderRequestParameters(canonical,
new ArrayEventContext(typeCoercer, context));
expect(factory.createPageRenderLink(parameters)).andReturn(link);
listener.createdPageRenderLink(link);
replay();
LinkSource source = new LinkSourceImpl(null, null,
collector, factory, typeCoercer, resolver);
source.getLinkCreationHub().addListener(listener);
Object[] passedContext = overrideContext ? context : new Object[0];
Link returnedLink = source.createPageRenderLink(pageName, overrideContext, passedContext);
assertSame(returnedLink, link);
verify();
}