### Question:
ClassLoaderUtils { public static URL[] getURLsForClasspath(String modulePath, FilenameFilter filenameFilter, boolean suppressExceptions) throws MalformedURLException { return getURLsForClasspath(modulePath == null ? Collections.emptySet() : Collections.singleton(modulePath), filenameFilter, suppressExceptions); }  static ClassLoader getCustomClassLoader(String modulePath, ClassLoader parentClassLoader, FilenameFilter filenameFilter); static URL[] getURLsForClasspath(String modulePath, FilenameFilter filenameFilter, boolean suppressExceptions); static URL[] getURLsForClasspath(Set<String> modulePaths, FilenameFilter filenameFilter, boolean suppressExceptions); static String generateAdditionalUrlsFingerprint(Set<URL> urls);  }### Answer:
@Test public void testGetURLsForClasspathWithDirectory() throws MalformedURLException { final String jarFilePath = "src/test/resources/TestClassLoaderUtils"; URL[] urls = ClassLoaderUtils.getURLsForClasspath(jarFilePath, getJarFilenameFilter(), false); assertEquals(2, urls.length); }
@Test public void testGetURLsForClasspathWithSingleJAR() throws MalformedURLException { final String jarFilePath = "src/test/resources/TestClassLoaderUtils/TestSuccess.jar"; URL[] urls = ClassLoaderUtils.getURLsForClasspath(jarFilePath, null, false); assertEquals(1, urls.length); }
@Test(expected = MalformedURLException.class) public void testGetURLsForClasspathWithSomeNonExistentAndNoSuppression() throws MalformedURLException { final String jarFilePath = "src/test/resources/TestClassLoaderUtils/TestSuccess.jar,src/test/resources/TestClassLoaderUtils/FakeTest.jar"; ClassLoaderUtils.getURLsForClasspath(jarFilePath, null, false); }
@Test public void testGetURLsForClasspathWithSomeNonExistentAndSuppression() throws MalformedURLException { final String jarFilePath = "src/test/resources/TestClassLoaderUtils/TestSuccess.jar,src/test/resources/TestClassLoaderUtils/FakeTest.jar"; URL[] urls = ClassLoaderUtils.getURLsForClasspath(jarFilePath, null, true); assertEquals(1, urls.length); }
@Test public void testGetURLsForClasspathWithSetAndSomeNonExistentAndSuppression() throws MalformedURLException { final Set<String> modules = new HashSet<>(); modules.add("src/test/resources/TestClassLoaderUtils/TestSuccess.jar,src/test/resources/TestClassLoaderUtils/FakeTest1.jar"); modules.add("src/test/resources/TestClassLoaderUtils/FakeTest2.jar,src/test/resources/TestClassLoaderUtils/FakeTest3.jar"); URL[] urls = ClassLoaderUtils.getURLsForClasspath(modules, null, true); assertEquals(1, urls.length); }