ClassLoaderUtils { public static Set<URL> getResources(ClassLoader classLoader, ResourceType resourceType, String resourceName) throws NullPointerException, IOException { String normalizedResourceName = resourceType.resolve(resourceName); Enumeration<URL> resources = classLoader.getResources(normalizedResourceName); return resources != null && resources.hasMoreElements() ? Sets.newLinkedHashSet(EnumerationUtils.toList(resources)) : Collections.<URL>emptySet(); }  static int getLoadedClassCount(); static long getUnloadedClassCount(); static boolean isVerbose(); static void setVerbose(boolean value); static long getTotalLoadedClassCount(); static Set<Class<?>> findLoadedClasses(ClassLoader classLoader, Set<String> classNames); static boolean isLoadedClass(ClassLoader classLoader, Class<?> type); static boolean isLoadedClass(ClassLoader classLoader, String className); static Class<?> findLoadedClass(ClassLoader classLoader, String className); @Nullable static Class<?> loadClass(@Nonnull ClassLoader classLoader, @Nonnull String className); static Set<URL> getResources(ClassLoader classLoader, ResourceType resourceType, String resourceName); static Set<URL> getResources(ClassLoader classLoader, String resourceName); static URL getResource(ClassLoader classLoader, String resourceName); static URL getResource(ClassLoader classLoader, ResourceType resourceType, String resourceName); static URL getClassResource(ClassLoader classLoader, String className); static URL getClassResource(ClassLoader classLoader, Class<?> type); @Nonnull static Set<ClassLoader> getInheritableClassLoaders(ClassLoader classLoader); @Nonnull static Map<ClassLoader, Set<Class<?>>> getAllLoadedClassesMap(ClassLoader classLoader); @Nonnull static Set<Class<?>> getAllLoadedClasses(ClassLoader classLoader); @Nonnull static Set<Class<?>> getLoadedClasses(ClassLoader classLoader); static Set<Class<?>> findLoadedClassesInClassPath(ClassLoader classLoader); static Set<Class<?>> findLoadedClassesInClassPaths(ClassLoader classLoader, Set<String> classPaths); static Set<Class<?>> findLoadedClassesInClassPath(ClassLoader classLoader, String classPath);  }
@Test public void testGetResources() throws IOException { Set<URL> resourceURLs = ClassLoaderUtils.getResources(classLoader, ClassLoaderUtilsTest.class.getName() + FileSuffixConstants.CLASS); Assert.assertNotNull(resourceURLs); Assert.assertEquals(1, resourceURLs.size()); echo(resourceURLs); resourceURLs = ClassLoaderUtils.getResources(classLoader, " Assert.assertNotNull(resourceURLs); Assert.assertEquals(1, resourceURLs.size()); echo(resourceURLs); resourceURLs = ClassLoaderUtils.getResources(classLoader, " Assert.assertNotNull(resourceURLs); Assert.assertEquals(1, resourceURLs.size()); echo(resourceURLs); }