public void testStateHolderListenerWithPSS()
{
UIComponent component = new UIOutput();
ComponentSystemEventListener listener = new MyStateHolderListener();
//This case happens when @ListenerFor is attached on the component class
EventListenerWrapper wrapper = new EventListenerWrapper(component, listener);
wrapper.markInitialState();
Object state = wrapper.saveState(facesContext);
//In this case state should be not null, because it implements StateHolder
assertNotNull(state);
MyStateHolderListener listener2 = new MyStateHolderListener();
listener2.setI(2);
EventListenerWrapper wrapper2 = new EventListenerWrapper(component, listener2);
wrapper.markInitialState();
//For restore we need to setup the context first
component.pushComponentToEL(facesContext, component);
wrapper2.restoreState(facesContext, state);
component.popComponentFromEL(facesContext);
assertNotNull(wrapper2.getComponentSystemEventListener());
assertEquals(wrapper.getComponentSystemEventListener(), wrapper2.getComponentSystemEventListener());
}