@Test public void testWebLibFinder() throws Exception { URL libUrl = new URL("file:/somewhere/WEB-INF/lib/"); URL jarUrl = new URL("file", null, 0, "/somewhere/WEB-INF/lib/mylib.jar", new TestURLStreamHandler()); Set<String> libDirectory = new HashSet<String>(Arrays.asList("/WEB-INF/lib/mylib.jar")); PackageFilter filter = new PackageFilter(null); ServletContext servletContext = Mockito.mock(ServletContext.class); Mockito.when(servletContext.getResource("/WEB-INF/lib/")).thenReturn(libUrl); Mockito.when(servletContext.getResourcePaths("/WEB-INF/lib/")).thenReturn(libDirectory); Mockito.when(servletContext.getResource("/WEB-INF/lib/mylib.jar")).thenReturn(jarUrl); ClassLoader classLoader = Mockito.mock(ClassLoader.class); Mockito.when(classLoader.loadClass(ClassFinderTestBean.class.getName())) .thenReturn((Class) ClassFinderTestBean.class); Set<Class<? extends Annotation>> types = new HashSet<Class<? extends Annotation>>(); types.add(TestAnnotation.class); ByteCodeFilter byteCodeFilter = new ByteCodeFilter(types); ClassVisitor classVisitor = Mockito.mock(ClassVisitor.class); WebLibFinder finder = new WebLibFinder(servletContext, classLoader, filter, byteCodeFilter); finder.findClasses(classVisitor); Mockito.verify(classVisitor).visit(ClassFinderTestBean.class); }
public WebLibFinder(ServletContext servletContext, ClassLoader classLoader, PackageFilter packageFilter, ByteCodeFilter byteCodeFilter) { super(servletContext, classLoader, packageFilter, byteCodeFilter); }
WebLibFinder extends AbstractClassFinder { public WebLibFinder(ServletContext servletContext, ClassLoader classLoader, PackageFilter packageFilter, ByteCodeFilter byteCodeFilter) { super(servletContext, classLoader, packageFilter, byteCodeFilter); } }
WebLibFinder extends AbstractClassFinder { public WebLibFinder(ServletContext servletContext, ClassLoader classLoader, PackageFilter packageFilter, ByteCodeFilter byteCodeFilter) { super(servletContext, classLoader, packageFilter, byteCodeFilter); } WebLibFinder(ServletContext servletContext, ClassLoader classLoader, PackageFilter packageFilter,
            ByteCodeFilter byteCodeFilter); }
WebLibFinder extends AbstractClassFinder { public WebLibFinder(ServletContext servletContext, ClassLoader classLoader, PackageFilter packageFilter, ByteCodeFilter byteCodeFilter) { super(servletContext, classLoader, packageFilter, byteCodeFilter); } WebLibFinder(ServletContext servletContext, ClassLoader classLoader, PackageFilter packageFilter,
            ByteCodeFilter byteCodeFilter); @Override void findClasses(ClassVisitor visitor); @Override int priority(); }
WebLibFinder extends AbstractClassFinder { public WebLibFinder(ServletContext servletContext, ClassLoader classLoader, PackageFilter packageFilter, ByteCodeFilter byteCodeFilter) { super(servletContext, classLoader, packageFilter, byteCodeFilter); } WebLibFinder(ServletContext servletContext, ClassLoader classLoader, PackageFilter packageFilter,
            ByteCodeFilter byteCodeFilter); @Override void findClasses(ClassVisitor visitor); @Override int priority();  }