@Test
public final void testColumnReordering() throws IOException {

    FacesRequest facesRequest = startFacesRequest();
    FacesContext facesContext = FacesContext.getCurrentInstance();
    AbstractExtendedDataTable component = (AbstractExtendedDataTable) facesContext.getViewRoot().findComponent("table");
    ExtendedDataTableRenderer renderer = (ExtendedDataTableRenderer) FacesContext.getCurrentInstance().getRenderKit()
        .getRenderer(component.getFamily(), component.getRendererType());
    Map<String, Object> componentAttributes = component.getAttributes();
    String clientId = component.getClientId(facesContext);
    assertNull(componentAttributes.get("columnsOrder"));
    facesRequest.withParameter(clientId, clientId);
    facesRequest.withParameter("rich:columnsOrder", "column2,column1");
    renderer.doDecode(facesContext, component);
    assertTrue(facesContext.getPartialViewContext().getRenderIds().contains(clientId));
    assertTrue(Arrays.equals(new String[] { "column2", "column1" }, (String[]) componentAttributes.get("columnsOrder")));
    facesRequest.release();
}