@Test
 public void testFactory() {
   DOMBuilder db = new DOMBuilder();
   assertTrue(db.getFactory() instanceof DefaultJDOMFactory);
   DefaultJDOMFactory fac = new DefaultJDOMFactory();
   assertFalse(db.getFactory() == fac);
   db.setFactory(fac);
   assertTrue(db.getFactory() == fac);
 }
  private void checkDOM(String resname, boolean xsdvalidate) {
    try {
      org.w3c.dom.Document domdoc = HelpTestDOMBuilder.getDocument(resname, xsdvalidate);
      DOMBuilder db = new DOMBuilder();
      Document dombuild = db.build(domdoc);
      Element domroot = db.build(HelpTestDOMBuilder.getRoot(domdoc));

      SAXBuilder sb =
          new SAXBuilder(xsdvalidate ? XMLReaders.XSDVALIDATING : XMLReaders.NONVALIDATING);
      sb.setExpandEntities(false);

      Document saxbuild = sb.build(FidoFetch.getFido().getURL(resname));
      Element saxroot = saxbuild.hasRootElement() ? saxbuild.getRootElement() : null;

      assertEquals(toString(saxbuild), toString(dombuild));
      assertEquals(toString(saxroot), toString(domroot));

    } catch (Exception e) {
      UnitTestUtil.failException("Could not parse file '" + resname + "': " + e.getMessage(), e);
    }
  }