GtrReader { public static GTRPublicData read(final Reader reader) throws IOException { checkNotNull(reader); try { JAXBContext context = JAXBContext.newInstance(GTRPublicData.class); Unmarshaller unmarshaller = context.createUnmarshaller(); SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); URL schemaURL = GtrReader.class.getResource("/org/nmdp/ngs/gtr/xsd/GTRPublicData.xsd"); Schema schema = schemaFactory.newSchema(schemaURL); unmarshaller.setSchema(schema); return (GTRPublicData) unmarshaller.unmarshal(reader); } catch (JAXBException | SAXException e) { throw new IOException("could not unmarshal GTRPublicData", e); } } private  GtrReader(); static GTRPublicData read(final Reader reader); static GTRPublicData read(final File file); static GTRPublicData read(final URL url); static GTRPublicData read(final InputStream inputStream);  }
@Test(expected=NullPointerException.class) public void testReadNullReader() throws Exception { read((Reader) null); }
@Test(expected=NullPointerException.class) public void testReadNullFile() throws Exception { read((File) null); }
@Test(expected=NullPointerException.class) public void testReadNullURL() throws Exception { read((URL) null); }
@Test(expected=NullPointerException.class) public void testReadNullInputStream() throws Exception { read((InputStream) null); }
@Test public void testReadFile() throws Exception { validate(read(createFile("gtr-example.xml"))); }
@Test(expected=IOException.class) public void testReadEmptyFile() throws Exception { read(createFile("empty.xml")); }
@Test(expected=IOException.class) public void testReadInvalidSyntaxFile() throws Exception { read(createFile("invalid-syntax.xml")); }
@Test(expected=IOException.class) public void testReadInvalidSchemaFile() throws Exception { read(createFile("invalid-schema.xml")); }
@Test public void testReadURL() throws Exception { validate(read(createURL("gtr-example.xml"))); }
@Test public void testReadInputStream() throws Exception { validate(read(createInputStream("gtr-example.xml"))); }