EDIAbstractReader implements XMLReader { public void parse(String systemId) throws SAXException, IOException { throw new SAXException("parse(systemId) not supported"); }  char getTerminator(); String getTerminatorSuffix(); void setDelimiter(char delimiter); void setSubDelimiter(char subDelimiter); void setSubSubDelimiter(char subSubDelimiter); void setDecimalMark(char decimalMark); void setRepetitionSeparator(char repetitionSeparator); void setTerminator(char terminator); void setRelease(int release); void setTerminatorSuffix(String terminatorSuffix); char getDelimiter(); char getSubDelimiter(); int getRelease(); char getReleaseCharacter(); boolean isReleaseCharacterDefined(); char getDecimalMark(); char getSubSubDelimiter(); char getRepetitionSeparator(); Tokenizer getTokenizer(); void setTokenizer(Tokenizer t); void setCopyWriter(Writer writer); abstract void preview(); void setAcknowledgment(Writer writer); void setAlternateAcknowledgment(Writer writer); void setAcknowledgment(Writer writer, SyntaxDescriptor syntaxDescriptor); boolean isInterchangeAcknowledgment(); void setInterchangeAcknowledgment(boolean interchangeAcknowledgment); boolean isGroupAcknowledgment(); void setGroupAcknowledgment(boolean groupAcknowledgment); SyntaxDescriptor getAcknowledgmentSyntaxDescriptor(); void setAcknowledgmentSyntaxDescriptor(SyntaxDescriptor syntaxDescriptor); TransactionCallback getTransactionCallback(); void setTransactionCallback(TransactionCallback transactionCallback); EDISyntaxExceptionHandler getSyntaxExceptionHandler(); void setSyntaxExceptionHandler(EDISyntaxExceptionHandler syntaxExceptionHandler); boolean isNamespaceEnabled(); void setNamespaceEnabled(boolean namespaceEnabled); boolean isIncludeSyntaxCharacters(); void setIncludeSyntaxCharacters(boolean includeSyntaxCharacters); boolean isExternalXmlDocumentStart(); void setExternalXmlDocumentStart(boolean externalXmlDocumentStart); void setLocale(Locale locale); void setEntityResolver(EntityResolver resolver); void setDTDHandler(DTDHandler handler); void setErrorHandler(ErrorHandler handler); void parse(String systemId); void setContentHandler(ContentHandler handler); ContentHandler getContentHandler(); void setFeature(String name, boolean value); boolean getFeature(String name); void setProperty(String name, Object value); Object getProperty(String name); EDIAttributes getDocumentAttributes(); EDIAttributes getInterchangeAttributes(); EDIAttributes getGroupAttributes(); BranchingWriter getAckStream(); void setAckStream(BranchingWriter ackStream); BranchingWriter getAlternateAckStream(); boolean isPreviewed(); void setPreviewed(boolean previewed); ErrorHandler getErrorHandler(); DTDHandler getDTDHandler(); EntityResolver getEntityResolver(); int getCharCount(); int getSegmentCharCount(); String getFirstSegment(); void setFirstSegment(String firstSegment); @Override String toString();  }
@Test public void testParse() throws Exception { inputSource = EDITestData.getAnsiInputSource(); reader = EDIReaderFactory.createEDIReader(inputSource); assertNotNull(reader.getTokenizer()); reader.setContentHandler(new DefaultHandler()); try { reader.parse(""); fail("should have thrown an exception"); } catch (SAXException ignore) { } reader.parse(inputSource); inputSource = EDITestData.getEdifactInputSource(); reader = EDIReaderFactory.createEDIReader(inputSource); assertNotNull(reader.getTokenizer()); reader.setContentHandler(new DefaultHandler()); try { reader.parse(""); fail("should have thrown an exception"); } catch (SAXException ignore) { } assertEquals(0, reader.getCharCount()); assertEquals(0, reader.getSegmentCharCount()); reader.parse(inputSource); assertEquals(EDITestData.getEdifactInterchange().length(), reader.getCharCount()); assertEquals(24, reader.getSegmentCharCount()); inputSource = new InputSource(new StringReader("this is not edi")); try { EDIReaderFactory.createEDIReader(inputSource); } catch (EDISyntaxException e) { assertEquals("No supported EDI standard interchange begins with thi", e.getMessage()); } }