public void testAjaxSelectedEvent() {
MockViewRoot mockViewRoot = (MockViewRoot) facesContext.getViewRoot();
tree.setAjaxSubmitSelection(true);
treeNode.setAjaxSubmitSelection("inherit");
MockMethodBinding binding = new MockMethodBinding();
treeNode.setNodeSelectListener(binding);
EventsQueue events = mockViewRoot.getAjaxEventsQueue();
assertNotNull(events);
assertEquals(0, events.size());
AjaxSelectedEvent event = new AjaxSelectedEvent(treeNode, null);
TreeEvents.invokeListenerBindings(treeNode, event, facesContext);
assertEquals(1, events.size());
Object[][] args = binding.getInvocationArgs();
assertEquals(1, args.length);
assertEquals(1, args[0].length);
assertSame(event, args[0][0]);
}