### Question:
RepositoriesMeta { public void readDataFromInputStream( InputStream is ) throws KettleException { clear(); if ( log.isBasic() ) { log.logBasic( BaseMessages.getString( PKG, "RepositoryMeta.Log.ReadingXMLFile", "FromInputStream" ) ); } try { DocumentBuilderFactory dbf = XMLParserFactoryProducer.createSecureDocBuilderFactory(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse( is ); parseRepositoriesDoc( doc ); } catch ( Exception e ) { throw new KettleException( BaseMessages.getString( PKG, "RepositoryMeta.Error.ReadingInfo" ), e ); } } RepositoriesMeta(); void clear(); void addDatabase( DatabaseMeta ci ); void addRepository( RepositoryMeta ri ); void addDatabase( int p, DatabaseMeta ci ); void addRepository( int p, RepositoryMeta ri ); DatabaseMeta getDatabase( int i ); RepositoryMeta getRepository( int i ); void removeDatabase( int i ); void removeRepository( int i ); int nrDatabases(); int nrRepositories(); DatabaseMeta searchDatabase( String name ); RepositoryMeta searchRepository( String name ); int indexOfDatabase( DatabaseMeta di ); int indexOfRepository( RepositoryMeta ri ); RepositoryMeta findRepository( String name ); RepositoryMeta findRepositoryById( String id ); boolean readData(); void readDataFromInputStream( InputStream is ); String getXML(); void writeData(); String toString(); RepositoriesMeta clone(); String getErrorMessage(); LogChannelInterface getLog();  }### Answer:
@Test public void testReadDataFromInputStream() throws Exception { InputStream inputStream = getClass().getResourceAsStream( "repositories.xml" ); repoMeta.readDataFromInputStream( inputStream ); assertEquals( 1, repoMeta.nrDatabases() ); assertEquals( 1, repoMeta.nrRepositories() ); }
@Test public void testErrorReadingInputStream() throws Exception { try { repoMeta.readDataFromInputStream( getClass().getResourceAsStream( "filedoesnotexist.xml" ) ); } catch ( KettleException e ) { assertEquals( Const.CR + "Error reading information from file:" + Const.CR + "InputStream cannot be null" + Const.CR, e.getMessage() ); } }
@Test( expected = KettleException.class ) public void exceptionThrownWhenParsingXmlWithBigAmountOfExternalEntitiesFromInputStream() throws Exception { repoMeta.readDataFromInputStream( new ByteArrayInputStream( XXEUtils.MALICIOUS_XML.getBytes() ) ); }