}
public void testComplexRender()
{
IMarkupWriter writer = newWriter();
NestedMarkupWriter nested = newNestedWriter();
IRequestCycle cycle = newCycle();
IEngine engine = newEngine(getClassResolver());
IValidationDelegate delegate = newDelegate();
ILink link = newLink();
IRender render = newRender();
MockForm form = new MockForm(delegate);
trainIsRewound(cycle, form, false);
trainGetEngine(cycle, engine);
PageRenderSupport support = newPageRenderSupport();
trainGetPageRenderSupport(cycle, support);
replayControls();
final FormSupport fs = new FormSupportImpl(writer, cycle, form);
verifyControls();
final IFormComponent barney1 = newFormComponent("barney", "barney");
final IFormComponent wilma = newFormComponent("wilma", "wilma");
final IFormComponent barney2 = newFormComponent("barney", "barney_0");
IRender body = newComponentsRenderBody(fs, new IFormComponent[]
{ barney1, wilma, barney2 }, nested);
form.setBody(body);
trainRegister(support);
trainGetParameterNames(link, new String[]
{ "service" });
trainGetParameterValues(link, "service", new String[]
{ "fred" });
trainGetNestedWriter(writer, nested);
trainGetURL(link, null, "/app");
writer.begin("form");
writer.attribute("method", "post");
writer.attribute("action", "/app");
writer.attribute("name", "myform");
writer.attribute("id", "myform");
render.render(writer, cycle);
writer.println();
trainDiv(writer);
trainHidden(writer, "formids", "barney,wilma,barney_0");
trainHidden(writer, "service", "fred");
trainHidden(writer, "submitmode", "");
writer.end();
nested.close();
writer.end();
trainGetFocusField(delegate, "wilma");
trainGetFieldFocus(cycle, null);