### Question:
ApplicationClassLoader extends URLClassLoader { @VisibleForTesting static URL[] constructUrlsFromClasspath(String classpath) throws MalformedURLException { List<URL> urls = new ArrayList<URL>(); for (String element : Splitter.on(File.pathSeparator).split(classpath)) { if (element.endsWith("/*")) { String dir = element.substring(0, element.length() - 1); File[] files = new File(dir).listFiles(JAR_FILENAME_FILTER); if (files != null) { for (File file : files) { urls.add(file.toURI().toURL()); } } } else { File file = new File(element); if (file.exists()) { urls.add(new File(element).toURI().toURL()); } } } return urls.toArray(new URL[urls.size()]); } ApplicationClassLoader(URL[] urls, ClassLoader parent,
      List<String> systemClasses);  ApplicationClassLoader(String classpath, ClassLoader parent,
      List<String> systemClasses); @Override URL getResource(String name); @Override Class<?> loadClass(String name);  }### Answer:
@Test public void testConstructUrlsFromClasspath() throws Exception { File file = new File(testDir, "file"); assertTrue("Create file", file.createNewFile()); File dir = new File(testDir, "dir"); assertTrue("Make dir", dir.mkdir()); File jarsDir = new File(testDir, "jarsdir"); assertTrue("Make jarsDir", jarsDir.mkdir()); File nonJarFile = new File(jarsDir, "nonjar"); assertTrue("Create non-jar file", nonJarFile.createNewFile()); File jarFile = new File(jarsDir, "a.jar"); assertTrue("Create jar file", jarFile.createNewFile()); File nofile = new File(testDir, "nofile"); StringBuilder cp = new StringBuilder(); cp.append(file.getAbsolutePath()).append(File.pathSeparator) .append(dir.getAbsolutePath()).append(File.pathSeparator) .append(jarsDir.getAbsolutePath() + "/*").append(File.pathSeparator) .append(nofile.getAbsolutePath()).append(File.pathSeparator) .append(nofile.getAbsolutePath() + "/*").append(File.pathSeparator); URL[] urls = constructUrlsFromClasspath(cp.toString()); assertEquals(3, urls.length); assertEquals(file.toURI().toURL(), urls[0]); assertEquals(dir.toURI().toURL(), urls[1]); assertEquals(jarFile.toURI().toURL(), urls[2]); }