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"));
int indexDynHeader1_1 = content1.indexOf("Start Dynamic Header");
int indexDynHeader1_2 = content1.indexOf("Dynamically added header", indexDynHeader1_1);
int indexDynHeader1_3 = content1.indexOf("End Dynamic Header", indexDynHeader1_2);
Assert.assertNotSame(-1, indexDynHeader1_1);
Assert.assertNotSame(-1, indexDynHeader1_2);
Assert.assertNotSame(-1, indexDynHeader1_3);
UICommand button = (UICommand) facesContext.getViewRoot().findComponent("mainForm:postback");
submit(button);
processLifecycleExecuteAndRender();
comp = facesContext.getViewRoot().findComponent("mainForm:component");
Assert.assertEquals(1, comp.getChildCount());
wrapper = comp.getChildren().get(0);
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 writer2 = (MockPrintWriter) response.getWriter();
String content2 = new String(writer2.content());
Assert.assertTrue(content2.contains("Dynamically added markup"));
int indexDynHeader1 = content2.indexOf("Start Dynamic Header");
int indexDynHeader2 = content2.indexOf("Dynamically added header", indexDynHeader1);
int indexDynHeader3 = content2.indexOf("End Dynamic Header", indexDynHeader2);
Assert.assertNotSame(-1, indexDynHeader1);