Assert.assertNotNull(ccContent);
Assert.assertEquals(3, ccContent.getChildCount());
Assert.assertEquals("Dynamically added header",
ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
Assert.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer1 = (MockPrintWriter) response.getWriter();
String content1 = new String(writer1.content());
Assert.assertTrue(content1.contains("Dynamically added markup"));
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecute();
UIComponent comp2 = facesContext.getViewRoot().findComponent("panel");
Assert.assertNotNull(comp2);
Assert.assertEquals(2, comp2.getChildCount());
Assert.assertEquals("value1", comp2.getAttributes().get("attr1"));
Assert.assertEquals("value2", comp2.getChildren().get(0).getAttributes().get("attr2"));
wrapper = comp2.getChildren().get(1);
Assert.assertNotNull(wrapper);
Assert.assertTrue(UIComponent.isCompositeComponent(wrapper));
ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
Assert.assertNotNull(ccContent);
Assert.assertEquals(3, ccContent.getChildCount());
Assert.assertEquals("Dynamically added header",
ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
Assert.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
renderResponse();
MockPrintWriter writer2 = (MockPrintWriter) response.getWriter();
String content2 = new String(writer2.content());
Assert.assertTrue(content2.contains("Dynamically added markup"));
button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
client.submit(button);
processLifecycleExecuteAndRender();
UIComponent comp3 = facesContext.getViewRoot().findComponent("panel");
Assert.assertNotNull(comp3);
Assert.assertEquals(2, comp3.getChildCount());
Assert.assertEquals("value1", comp3.getAttributes().get("attr1"));
Assert.assertEquals("value2", comp3.getChildren().get(0).getAttributes().get("attr2"));
wrapper = comp3.getChildren().get(1);
Assert.assertNotNull(wrapper);
Assert.assertTrue(UIComponent.isCompositeComponent(wrapper));
ccContent = wrapper.getFacet(UIComponent.COMPOSITE_FACET_NAME);
Assert.assertNotNull(ccContent);
Assert.assertEquals(3, ccContent.getChildCount());
Assert.assertEquals("Dynamically added header",
ccContent.getChildren().get(0).getFacet("header").getAttributes().get("value"));
Assert.assertEquals("Dynamically added child", ccContent.getChildren().get(2).getAttributes().get("value"));
MockPrintWriter writer3 = (MockPrintWriter) response.getWriter();
String content3 = new String(writer3.content());
Assert.assertTrue(content3.contains("Dynamically added markup"));
endRequest();
}