SraReader { public static Experiment readExperiment(final Reader reader) throws IOException { checkNotNull(reader); try { JAXBContext context = JAXBContext.newInstance(Experiment.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 experimentSchemaURL = SraReader.class.getResource("/org/nmdp/ngs/sra/xsd/SRA.experiment.xsd"); Schema schema = schemaFactory.newSchema(new StreamSource[] { new StreamSource(commonSchemaURL.toString()), new StreamSource(experimentSchemaURL.toString()) }); unmarshaller.setSchema(schema); return (Experiment) unmarshaller.unmarshal(reader); } catch (JAXBException | SAXException e) { throw new IOException("could not unmarshal Experiment", 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 testReadExperimentNullReader() throws Exception { readExperiment((Reader) null); }
@Test(expected=NullPointerException.class) public void testReadExperimentNullFile() throws Exception { readExperiment((File) null); }
@Test(expected=NullPointerException.class) public void testReadExperimentNullURL() throws Exception { readExperiment((URL) null); }
@Test(expected=NullPointerException.class) public void testReadExperimentNullInputStream() throws Exception { readExperiment((InputStream) null); }
@Test public void testReadExperimentFile() throws Exception { validate(readExperiment(createFile("sra-experiment-example.xml"))); }
@Test(expected=IOException.class) public void testReadExperimentEmptyFile() throws Exception { readExperiment(createFile("empty.xml")); }
@Test(expected=IOException.class) public void testReadExperimentInvalidSyntaxFile() throws Exception { readExperiment(createFile("invalid-experiment-syntax.xml")); }
@Test(expected=IOException.class) public void testReadExperimentInvalidSchemaFile() throws Exception { readExperiment(createFile("invalid-experiment-schema.xml")); }
@Test public void testReadExperimentURL() throws Exception { validate(readExperiment(createURL("sra-experiment-example.xml"))); }
@Test public void testReadExperimentInputStream() throws Exception { validate(readExperiment(createInputStream("sra-experiment-example.xml"))); }