### Question:
JaxbAssertionBuilder implements AssertionBuilder<Element> { public Assertion build(Element element, AssertionBuilderFactory factory) { QName name = new QName(element.getNamespaceURI(), element.getLocalName()); JaxbAssertion<T> assertion = buildAssertion(); assertion.setName(name); assertion.setOptional(XMLPrimitiveAssertionBuilder.isOptional(element)); assertion.setIgnorable(XMLPrimitiveAssertionBuilder.isIgnorable(element)); assertion.setData(getData(element)); return assertion; } JaxbAssertionBuilder(QName qn); @SuppressWarnings("unchecked")  JaxbAssertionBuilder(String className, QName qn);  JaxbAssertionBuilder(Class<T> type, QName qn); Assertion build(Element element, AssertionBuilderFactory factory); QName[] getKnownElements();  }### Answer:
@Test public void testBuild() throws Exception { QName qn = new QName("http: JaxbAssertionBuilder<FooType> ab = new JaxbAssertionBuilder<>(FooType.class, qn); assertNotNull(ab); InputStream is = JaxbAssertionBuilderTest.class.getResourceAsStream("foo.xml"); Document doc = StaxUtils.read(is); Element elem = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(), "http: "foo").get(0); Assertion a = ab.build(elem, null); JaxbAssertion<FooType> jba = JaxbAssertion.cast(a, FooType.class); FooType foo = jba.getData(); assertEquals("CXF", foo.getName()); assertEquals(2, foo.getNumber().intValue()); }
@Test public void testBuild() throws Exception { QName qn = new QName("http: JaxbAssertionBuilder<FooType> ab = new JaxbAssertionBuilder<FooType>(FooType.class, qn); assertNotNull(ab); InputStream is = JaxbAssertionBuilderTest.class.getResourceAsStream("foo.xml"); Document doc = DOMUtils.readXml(is); Element elem = DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(), "http: "foo").get(0); Assertion a = ab.build(elem, null); JaxbAssertion<FooType> jba = JaxbAssertion.cast(a, FooType.class); FooType foo = jba.getData(); assertEquals("CXF", foo.getName()); assertEquals(2, foo.getNumber().intValue()); }