PackageNamesScanner extends AbstractResourceFinderAdapter { @Override public void close() { compositeResourceFinder.close(); } PackageNamesScanner(final String[] packages, final boolean recursive);  PackageNamesScanner(final ClassLoader classLoader, final String[] packages, final boolean recursive); @Override boolean hasNext(); @Override String next(); @Override InputStream open(); @Override void close(); @Override void reset(); static void setResourcesProvider(final ResourcesProvider provider);  }
@Test public void testInputStreamClosedAfterClose(@Mocked final JarInputStream stream) throws Exception { final PackageNamesScanner scanner1 = new PackageNamesScanner(new String[] {"javax.ws.rs"}, false); final PackageNamesScanner scanner2 = new PackageNamesScanner(new String[] {"javax.ws.rs.core"}, false); final PackageNamesScanner scanner3 = new PackageNamesScanner(new String[] {"javax.ws.rs.client"}, false); scanner1.close(); scanner2.close(); scanner2.close(); scanner3.close(); new Verifications() {{ stream.close(); times = 3; }}; }