SraReader { public static Analysis readAnalysis(final Reader reader) throws IOException { checkNotNull(reader); try { JAXBContext context = JAXBContext.newInstance(Analysis.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 analysisSchemaURL = SraReader.class.getResource("/org/nmdp/ngs/sra/xsd/SRA.analysis.xsd"); Schema schema = schemaFactory.newSchema(new StreamSource[] { new StreamSource(commonSchemaURL.toString()), new StreamSource(analysisSchemaURL.toString()) }); unmarshaller.setSchema(schema); return (Analysis) unmarshaller.unmarshal(reader); } catch (JAXBException | SAXException e) { throw new IOException("could not unmarshal Analysis", 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 testReadAnalysisNullReader() throws Exception { readAnalysis((Reader) null); }
@Test(expected=NullPointerException.class) public void testReadAnalysisNullFile() throws Exception { readAnalysis((File) null); }
@Test(expected=NullPointerException.class) public void testReadAnalysisNullURL() throws Exception { readAnalysis((URL) null); }
@Test(expected=NullPointerException.class) public void testReadAnalysisNullInputStream() throws Exception { readAnalysis((InputStream) null); }
@Test public void testReadAnalysisFile() throws Exception { validate(readAnalysis(createFile("sra-analysis-example.xml"))); }
@Test(expected=IOException.class) public void testReadAnalysisEmptyFile() throws Exception { readAnalysis(createFile("empty.xml")); }
@Test(expected=IOException.class) public void testReadAnalysisInvalidSyntaxFile() throws Exception { readAnalysis(createFile("invalid-analysis-syntax.xml")); }
@Test(expected=IOException.class) public void testReadAnalysisInvalidSchemaFile() throws Exception { readAnalysis(createFile("invalid-analysis-schema.xml")); }
@Test public void testReadAnalysisURL() throws Exception { validate(readAnalysis(createURL("sra-analysis-example.xml"))); }
@Test public void testReadAnalysisInputStream() throws Exception { validate(readAnalysis(createInputStream("sra-analysis-example.xml"))); }