DomBuildingSaxHandler extends ContextAwareSaxAdapter { public Document getDocument() { return document; } DomBuildingSaxHandler(); Document getDocument(); @Override void start(String uri, String name, String data, EDIAttributes attributes); @Override void end(String uri, String name);  }
@Test public void testBuildDom() throws Exception { Document baselineDom = DocumentUtil.getInstance().buildDocumentFromEdi(inputSource); inputSource = EDITestData.getAnsiInputSource(); EDIReader parser = EDIReaderFactory.createEDIReader(inputSource); parser.setContentHandler(saxHandler); parser.parse(inputSource); Document dom = ((DomBuildingSaxHandler) saxHandler).getDocument(); assertDomsAreEquivalent(baselineDom, dom); }