BehaviorBean extends ElementBeanBase<BehaviorBean.BehaviorExtension> { public void setTargetClass(ClassName behaviorClass) { this.targetClass = behaviorClass; }  @XmlElement(name = "behavior-id", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE) FacesId getId(); void setId(FacesId id); @Override @XmlElement(name = "property", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE, type = PropertyBean.class) @XmlJavaTypeAdapter(PropertyAdapter.class) Collection<PropertyModel> getProperties(); @Override @XmlElement(name = "attribute", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE, type = AttributeBean.class) @XmlJavaTypeAdapter(AttributeAdapter.class) Collection<AttributeModel> getFacesAttributes(); @XmlElement(name = "behavior-class", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE) ClassName getTargetClass(); void setTargetClass(ClassName behaviorClass); @Override @XmlElement(name = "behavior-extension", namespace = ComponentLibrary.FACES_CONFIG_NAMESPACE) BehaviorExtension getExtension(); @Override void setExtension(BehaviorExtension extension);  }
@Test public void testMarshal() throws Exception { ComponentLibrary library = new ComponentLibrary(); BehaviorModel behaviorModel = new BehaviorModel(FacesId.parseId("my_behavior")); behaviorModel.setTargetClass(ClassName.parseName(Object.class.getName())); PropertyBase prop = behaviorModel.getOrCreateAttribute("attr1"); prop.setType(new ClassName(String.class)); AttributeModel attributeModel = new AttributeModel(); attributeModel.setName("attr2"); attributeModel.setType(new ClassName(String.class)); behaviorModel.getAttributes().add(attributeModel); library.getBehaviors().add(behaviorModel); StringWriter facesConfig = generateFacesConfig(library); log.debug(facesConfig.toString()); checkXmlStructure(facesConfig); validateXml(facesConfig); }