final VirtualFile mountDir = VFS.getChild("content");
ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
try (TempFileProvider provider = TempFileProvider.create("test", executor, false);
Closeable mount = VFS.mountZip(VFS.getChild(jaxRsApiPath), mountDir, provider)) {
ResourceFinder finder = new VfsSchemeResourceFinderFactory().create(new URI(mountDir.toURI().toString() + "/javax/ws/rs"), true);
int scannedEntryCount = 0;
while (finder.hasNext()) {
// Fetch next entry.
finder.next();
// This test doesn't actually do anything with the input stream, but it is important that it
// open/close the stream to simulate actual usage. The reported defect is only exposed if you
// call open/close in some fashion.
try (InputStream classStream = finder.open()) {
scannedEntryCount++;
}
}
assertThat("Failed to enumerate all contents of javax.ws.rs-api.", scannedEntryCount, equalTo(actualEntries));