### Question:
StringSubstitutionParser { @SuppressWarnings("rawtypes") public static StringsubsDefinition parse(InputStream configStream) throws StringSubstitutionException { if(configStream == null) { throw new StringSubstitutionException(STRINGS.get("invalidStream")); } try { URL schemaUrl = StringSubstitutionParser.class.getClassLoader().getResource(DEFAULT_SCHEMA); JAXBContext context = JAXBContext.newInstance(StringsubsDefinition.class.getPackage().getName()); Unmarshaller unmarshaller = context.createUnmarshaller(); SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema schema = schemaFactory.newSchema(schemaUrl); unmarshaller.setSchema(schema); InputSource is = new InputSource(configStream); SAXSource source = new SAXSource(is); Object obj = unmarshaller.unmarshal(source); return obj instanceof JAXBElement ? (StringsubsDefinition) ((JAXBElement) obj).getValue() : (StringsubsDefinition) obj; } catch(SAXException | JAXBException se) { throw new StringSubstitutionException(STRINGS.get("failedToParse", DEFAULT_SCHEMA), se); } finally { try { configStream.close(); configStream = null; } catch (IOException e) { if (LOGGER.isLoggable(Level.FINER)) { LOGGER.log(Level.FINER, STRINGS.get("errorInClosingStream")); } } } }  @SuppressWarnings("rawtypes") static StringsubsDefinition parse(InputStream configStream);  }### Answer:
@Test public void testParserWithNullInput() { try { StringSubstitutionParser.parse(null); } catch (StringSubstitutionException e) { return; } Assert.fail("Failed, Parser is allowing null stream to parse."); }
@Test public void testParser() { StringsubsDefinition def = null; try { def = StringSubstitutionParser.parse(_configStream); } catch (StringSubstitutionException e) { Assert.fail("Failed to parse xml : " + _stringSubsPath, e); } Assert.assertNotNull(def); Assert.assertNotNull(def.getComponent()); Assert.assertNotNull(def.getVersion()); Assert.assertFalse(def.getChangePair().isEmpty()); }