}
facesContext.getExternalContext().getRequestMap().put("items", list);
UIViewRoot root = facesContext.getViewRoot();
UIData data = new HtmlDataTable();
data.setId("table");
root.getChildren().add(data);
data.setValue(new ListDataModel(list));
data.setVar("item");
data.setRows(rowCount);
UIColumn col = new HtmlColumn();
data.getChildren().add(col);
UIOutput text = new HtmlOutputText();
text.setId("text");
text.setValue(facesContext.getApplication().
getExpressionFactory().createValueExpression(
facesContext.getELContext(), "#{item.name}", String.class));
col.getChildren().add(text);
UIInput inputText = new HtmlInputText();
inputText.setId("text");
inputText.setValue(facesContext.getApplication().
getExpressionFactory().createValueExpression(
facesContext.getELContext(), "#{item.lastName}", String.class));
col.getChildren().add(inputText);
for (int i = 0; i < rowCount ; i++)
{
data.setRowIndex(i);
Assert.assertEquals(data.getId()+":"+i+":"+text.getId(), text.getClientId());
Assert.assertEquals(data.getId()+":"+i+":"+inputText.getId(), inputText.getClientId());
}
data.setRowIndex(-1);
Assert.assertEquals(data.getId()+":"+text.getId(), text.getClientId());
Assert.assertEquals(data.getId()+":"+inputText.getId(), inputText.getClientId());
}