Map session = faces.getExternalContext().getSessionMap();
Employee e = new Employee();
session.put("employee", e);
FaceletFactory f = FaceletFactory.getInstance();
Facelet at = f.getFacelet("if.xml");
UIViewRoot root = faces.getViewRoot();
// make sure the form is there
e.setManagement(true);
at.apply(faces, root);
UIComponent c = root.findComponent("form");
assertNotNull("form is null", c);
// now make sure it isn't
e.setManagement(false);
at.apply(faces, root);
c = root.findComponent("form");
assertNull("form is not null", c);
}