{
Location l = newLocation();
IMarkupWriter writer = newWriter();
IRequestCycle cycle = newCycle();
IValidationDelegate delegate = newDelegate();
ComponentEventInvoker invoker =
org.easymock.classextension.EasyMock.createMock(ComponentEventInvoker.class);
MockForm form = new MockForm(delegate, l);
trainIsRewound(cycle, form, true);
trainGetPageRenderSupport(cycle, null);
replay();
final FormSupport fs = newFormSupport(writer, cycle, form);
verify();
delegate.clear();
// So, the scenario here is that component "barney" was inside
// some kind of loop that executed twice on the render, but only once
// on the rewind (i.e., the object was deleted in between).
trainCycleForRewind(cycle, "barney,wilma,barney$0", null);
final IFormComponent barney1 = newFormComponent("barney", "barney");
final IFormComponent wilma = newFormComponent("wilma", "wilma");
IRender body = newComponentsRenderBody(fs, new IFormComponent[]
{ barney1, wilma }, writer);
form.setBody(body);
form.setEventInvoker(invoker);
trainExtractBrowserEvent(cycle);
invoker.invokeFormListeners(eq(fs), eq(cycle), isA(BrowserEvent.class));
replay();
try
{