### Question:
WrapperBeanAnnotator implements Annotator { public void annotate(final JavaAnnotatable clz) { WrapperBeanClass beanClass = null; if (clz instanceof WrapperBeanClass) { beanClass = (WrapperBeanClass) clz; } else { throw new RuntimeException("WrapperBeanAnnotator expect JavaClass as input"); } JAnnotation xmlRootElement = new JAnnotation(XmlRootElement.class); xmlRootElement.addElement(new JAnnotationElement("name", beanClass.getElementName().getLocalPart())); xmlRootElement.addElement(new JAnnotationElement("namespace", beanClass.getElementName().getNamespaceURI())); JAnnotation xmlAccessorType = new JAnnotation(XmlAccessorType.class); xmlAccessorType.addElement(new JAnnotationElement(null, XmlAccessType.FIELD)); XmlType tp = null; if (sourceClass != null) { tp = sourceClass.getAnnotation(XmlType.class); } JAnnotation xmlType = new JAnnotation(XmlType.class); if (tp == null) { xmlType.addElement(new JAnnotationElement("name", beanClass.getElementName().getLocalPart())); xmlType.addElement(new JAnnotationElement("namespace", beanClass.getElementName().getNamespaceURI())); } else { if (!"##default".equals(tp.name())) { xmlType.addElement(new JAnnotationElement("name", tp.name())); } if (!"##default".equals(tp.namespace())) { xmlType.addElement(new JAnnotationElement("namespace", tp.namespace())); } if (!StringUtils.isEmpty(tp.factoryMethod())) { xmlType.addElement(new JAnnotationElement("factoryMethod", tp.factoryMethod())); } if (tp.propOrder().length != 1 || !StringUtils.isEmpty(tp.propOrder()[0])) { xmlType.addElement(new JAnnotationElement("propOrder", tp.propOrder())); } } List<String> props = new ArrayList<>(); for (JavaField f : beanClass.getFields()) { props.add(f.getParaName()); } if (props.size() > 1) { xmlType.addElement(new JAnnotationElement("propOrder", props)); } beanClass.addAnnotation(xmlRootElement); beanClass.addAnnotation(xmlAccessorType); beanClass.addAnnotation(xmlType); } WrapperBeanAnnotator();  WrapperBeanAnnotator(Class<?> cls); void annotate(final JavaAnnotatable clz);  }### Answer:
@Test public void testAnnotate() { String pkgName = "org.apache.cxf.tools.fortest.withannotation.doc.jaxws"; WrapperBeanClass clz = new WrapperBeanClass(); clz.setFullClassName(pkgName + ".SayHi"); clz.setElementName(new QName("http: clz.annotate(new WrapperBeanAnnotator()); List<JAnnotation> annotations = clz.getAnnotations(); String expectedNamespace = "http: JAnnotation rootElementAnnotation = annotations.get(0); assertEquals("@XmlRootElement(name = \"sayHi\", " + "namespace = \"" + expectedNamespace + "\")", rootElementAnnotation.toString()); JAnnotation xmlTypeAnnotation = annotations.get(2); assertEquals("@XmlType(name = \"sayHi\", " + "namespace = \"" + expectedNamespace + "\")", xmlTypeAnnotation.toString()); JAnnotation accessorTypeAnnotation = annotations.get(1); assertEquals("@XmlAccessorType(XmlAccessType.FIELD)", accessorTypeAnnotation.toString()); WrapperBeanClass resWrapperClass = new WrapperBeanClass(); resWrapperClass.setFullClassName(pkgName + ".SayHiResponse"); resWrapperClass.setElementName(new QName(expectedNamespace, "sayHiResponse")); resWrapperClass.annotate(new WrapperBeanAnnotator()); annotations = resWrapperClass.getAnnotations(); rootElementAnnotation = annotations.get(0); assertEquals("@XmlRootElement(name = \"sayHiResponse\", " + "namespace = \"" + expectedNamespace + "\")", rootElementAnnotation.toString()); accessorTypeAnnotation = annotations.get(1); assertEquals("@XmlAccessorType(XmlAccessType.FIELD)", accessorTypeAnnotation.toString()); xmlTypeAnnotation = annotations.get(2); assertEquals("@XmlType(name = \"sayHiResponse\", " + "namespace = \"" + expectedNamespace + "\")", xmlTypeAnnotation.toString()); }