IRequestCycle cycle = newCycle();
IComponent comp = newComponent();
checkOrder(comp, false);
IPage page = newMock(IPage.class);
ListenerInvoker listenerInvoker = newMock(ListenerInvoker.class);
ListenerMap listenerMap = newMock(ListenerMap.class);
IActionListener listener1 = newMock(IActionListener.class);
IComponentSpecification spec = new ComponentSpecification();
Map comps = new HashMap();
comps.put("testId", comp);
Map tprops = new HashMap();
tprops.put("id", "testId");
BrowserEvent event = new BrowserEvent("onSelect", new EventTarget(tprops));
ComponentEventInvoker invoker = new ComponentEventInvoker();
invoker.setInvoker(listenerInvoker);
spec.addEventListener("testId", new String[] { "onSelect" },
"fooListener", null, false, false, false, false);
invoker.addEventListener("testId", spec);
expect(comp.getExtendedId()).andReturn("testId").anyTimes();
expect(comp.getSpecification()).andReturn(spec).anyTimes();
expect(comp.getPage()).andReturn(page);
expect(page.getComponents()).andReturn(comps);
expect(comp.getListeners()).andReturn(listenerMap);
expect(listenerMap.getListener("fooListener")).andReturn(listener1);
listenerInvoker.invokeListener(listener1, comp, cycle);
replay();
invoker.invokeListeners(comp, cycle, event);