### Question:
FileArchive implements Archive { public Iterator<Entry> iterator() { return new ArchiveIterator(this, _iterator()); } FileArchive(ClassLoader loader, URL url);  FileArchive(ClassLoader loader, File dir);  FileArchive(ClassLoader loader, URL url, String basePackage);  FileArchive(ClassLoader loader, File dir, String basePackage); File getDir(); InputStream getBytecode(String className); Class<?> loadClass(String className); Iterator<Entry> iterator(); Iterator<String> _iterator(); static String decode(String fileName);  }### Answer:
@Test public void testBasePackageName() throws Exception { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); Enumeration<URL> resources = classLoader.getResources("org/acme/foo"); while (resources.hasMoreElements()) { URL url = resources.nextElement(); FileArchive fileArchive = new FileArchive(classLoader, url, "org.acme.foo"); Iterator<Archive.Entry> iterator = fileArchive.iterator(); while ( iterator.hasNext() ) { assertTrue(iterator.next().getName().startsWith("org.acme.foo")); } } }
@Test public void testIterator() throws Exception { List<String> actual = new ArrayList<String>(); for (Archive.Entry entry : archive) { actual.add(entry.getName()); } assertFalse(0 == actual.size()); for (Class clazz : classes) { assertTrue(clazz.getName(), actual.contains(Blue.class.getName())); } assertEquals(classes.length, actual.size()); }