* Test method for {@link org.ajax4jsf.component.UIDataAdaptor#saveState(javax.faces.context.FacesContext)}.
*/
public void testSaveStateFacesContext() throws Exception {
createDataTree();
data.setRowIndex(0);
MockComponentState mockState = (MockComponentState) adaptor.getComponentState();
mockState.setCount(123);
adaptor.encodeBegin(facesContext);
data.setRowIndex(1);
mockState = (MockComponentState) adaptor.getComponentState();
mockState.setCount(321);
adaptor.encodeBegin(facesContext);
UIViewRoot viewRoot = facesContext.getViewRoot();
Object treeState = viewRoot.processSaveState(facesContext);
UIViewRoot root = (UIViewRoot) viewRoot.getClass().newInstance();
UIData restoredData = new UIData();
UIDataAdaptor restoredAdaptor = new MockDataAdaptor();
root.getChildren().add(restoredData);
UIColumn column = new UIColumn();
restoredData.getChildren().add(column);
column.getChildren().add(restoredAdaptor);
root.processRestoreState(facesContext, treeState);
restoredData.setRowIndex(0);
mockState = (MockComponentState) restoredAdaptor.getComponentState();
assertEquals(123,mockState.getCount());
restoredData.setRowIndex(1);
mockState = (MockComponentState) restoredAdaptor.getComponentState();
assertEquals(321,mockState.getCount());
}