@@ -0,0 +1,2996 @@
+/*%0A * Copyright (c) 2016, Peter Ansell%0A * All rights reserved.%0A * %0A * Redistribution and use in source and binary forms, with or without%0A * modification, are permitted provided that the following conditions are met:%0A * %0A * * Redistributions of source code must retain the above copyright notice, this%0A *   list of conditions and the following disclaimer.%0A * %0A * * Redistributions in binary form must reproduce the above copyright notice,%0A *   this list of conditions and the following disclaimer in the documentation%0A *   and/or other materials provided with the distribution.%0A * %0A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS %22AS IS%22%0A * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE%0A * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE%0A * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE%0A * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL%0A * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR%0A * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER%0A * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,%0A * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE%0A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.%0A */%0Apackage com.github.ansell.dwca;%0A%0Aimport static org.junit.Assert.*;%0A%0Aimport java.io.IOException;%0Aimport java.io.InputStreamReader;%0Aimport java.io.Reader;%0A%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.xml.sax.SAXException;%0Aimport org.xml.sax.helpers.XMLReaderFactory;%0A%0A/**%0A * Tests for %7B@link DarwinCoreMetadataSaxParser%7D.%0A * %0A * @author Peter Ansell p_ansell@yahoo.com%0A */%0Apublic class DarwinCoreMetadataSaxParserTest %7B%0A%0A%09/**%0A%09 * @throws java.lang.Exception%0A%09 */%0A%09@Before%0A%09public void setUp() throws Exception %7B%0A%09%7D%0A%0A%09/**%0A%09 * @throws java.lang.Exception%0A%09 */%0A%09@After%0A%09public void tearDown() throws Exception %7B%0A%09%7D%0A%0A%09/**%0A%09 * Test method for%0A%09 * %7B@link com.github.ansell.dwca.DarwinCoreMetadataSaxParser#parse(java.io.Reader)%7D%0A%09 * .%0A%09 */%0A%09@Test%0A%09public final void testParseReader() throws Exception %7B%0A%09%09try (Reader inputStreamReader = new InputStreamReader(%0A%09%09%09%09this.getClass().getResourceAsStream(%22/com/github/ansell/dwca/metadata.xml%22));) %7B%0A%09%09%09DarwinCoreArchiveDocument parse = DarwinCoreMetadataSaxParser.parse(inputStreamReader);%0A%09%09%09assertNotNull(parse);%0A%09%09%7D%0A%09%7D%0A%0A%09/**%0A%09 * Test method for%0A%09 * %7B@link com.github.ansell.dwca.DarwinCoreMetadataSaxParser#parse(java.io.Reader, org.xml.sax.XMLReader)%7D%0A%09 * .%0A%09 */%0A%09@Test%0A%09public final void testParseReaderXMLReader() throws Exception %7B%0A%09%09try (Reader inputStreamReader = new InputStreamReader(%0A%09%09%09%09this.getClass().getResourceAsStream(%22/com/github/ansell/dwca/metadata.xml%22));) %7B%0A%09%09%09DarwinCoreArchiveDocument parse = DarwinCoreMetadataSaxParser.parse(inputStreamReader,%0A%09%09%09%09%09XMLReaderFactory.createXMLReader());%0A%09%09%09assertNotNull(parse);%0A%09%09%7D%0A%09%7D%0A%0A%7D%0A

Add basic tests for the two parse methods in the sax parser