Code example for ZipFile

Methods: getEntry, getInputStream

0
    public void metadataExtractionTest() throws AnalysisException, JDOMException, IOException, SAXException, TransformationException, URISyntaxException { 
        InputStream testStream = this.getClass().getResourceAsStream(TEST_FILE);
        BxDocument testDocument = extractor.extractStructure(testStream);
         
        URL url = this.getClass().getResource(EXP_ZIP_FILE);
        ZipFile zipFile = new ZipFile(new File(url.toURI()));
        InputStream inputStream = zipFile.getInputStream(zipFile.getEntry(EXP_FILE));
        BxDocument expDocument = new BxDocument().setPages(reader.read(new InputStreamReader(inputStream)));
         
        assertTrue(BxModelUtils.areEqual(expDocument, testDocument));
    } 
}