SraReader { public static Submission readSubmission(final Reader reader) throws IOException { checkNotNull(reader); try { JAXBContext context = JAXBContext.newInstance(Submission.class); Unmarshaller unmarshaller = context.createUnmarshaller(); SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); URL commonSchemaURL = SraReader.class.getResource("/org/nmdp/ngs/sra/xsd/SRA.common.xsd"); URL submissionSchemaURL = SraReader.class.getResource("/org/nmdp/ngs/sra/xsd/SRA.submission.xsd"); Schema schema = schemaFactory.newSchema(new StreamSource[] { new StreamSource(commonSchemaURL.toString()), new StreamSource(submissionSchemaURL.toString()) }); unmarshaller.setSchema(schema); return (Submission) unmarshaller.unmarshal(reader); } catch (JAXBException | SAXException e) { throw new IOException("could not unmarshal Submission", e); } }  static Analysis readAnalysis(final Reader reader); static Analysis readAnalysis(final File file); static Analysis readAnalysis(final URL url); static Analysis readAnalysis(final InputStream inputStream); static Experiment readExperiment(final Reader reader); static Experiment readExperiment(final File file); static Experiment readExperiment(final URL url); static Experiment readExperiment(final InputStream inputStream); static RunSet readRunSet(final Reader reader); static RunSet readRunSet(final File file); static RunSet readRunSet(final URL url); static RunSet readRunSet(final InputStream inputStream); static Sample readSample(final Reader reader); static Sample readSample(final File file); static Sample readSample(final URL url); static Sample readSample(final InputStream inputStream); static Study readStudy(final Reader reader); static Study readStudy(final File file); static Study readStudy(final URL url); static Study readStudy(final InputStream inputStream); static Submission readSubmission(final Reader reader); static Submission readSubmission(final File file); static Submission readSubmission(final URL url); static Submission readSubmission(final InputStream inputStream);  }
@Test(expected=NullPointerException.class) public void testReadSubmissionNullReader() throws Exception { readSubmission((Reader) null); }
@Test(expected=NullPointerException.class) public void testReadSubmissionNullFile() throws Exception { readSubmission((File) null); }
@Test(expected=NullPointerException.class) public void testReadSubmissionNullURL() throws Exception { readSubmission((URL) null); }
@Test(expected=NullPointerException.class) public void testReadSubmissionNullInputStream() throws Exception { readSubmission((InputStream) null); }
@Test public void testReadSubmissionFile() throws Exception { validate(readSubmission(createFile("sra-submission-example.xml"))); }
@Test(expected=IOException.class) public void testReadSubmissionEmptyFile() throws Exception { readSubmission(createFile("empty.xml")); }
@Test(expected=IOException.class) public void testReadSubmissionInvalidSyntaxFile() throws Exception { readSubmission(createFile("invalid-submission-syntax.xml")); }
@Test(expected=IOException.class) public void testReadSubmissionInvalidSchemaFile() throws Exception { readSubmission(createFile("invalid-submission-schema.xml")); }
@Test public void testReadSubmissionURL() throws Exception { validate(readSubmission(createURL("sra-submission-example.xml"))); }
@Test public void testReadSubmissionInputStream() throws Exception { validate(readSubmission(createInputStream("sra-submission-example.xml"))); }