ResourceList { protected static String getParentPackageName(String className){ if(className==null || className.isEmpty()){ return className; } int index = className.lastIndexOf('.'); if(index<0){ return ""; } return className.substring(0,index); } private  ResourceList(ClassLoader classLoader); static ResourceList getInstance(ClassLoader classLoader); void resetCache(); static void resetAllCaches(); boolean hasClass(String className); InputStream getClassAsStream(String name); Set<String> getAllClasses(String classPathEntry, boolean includeInternalClasses); Set<String> getAllClasses(String classPathEntry, String prefix, boolean includeInternalClasses); Set<String> getAllClasses(String classPathEntry, String prefix, boolean includeInternalClasses, boolean excludeAnonymous); static boolean isInterface(String resource); boolean isClassAnInterface(String className); boolean isClassDeprecated(String className); boolean isClassTestable(String className); static String getClassNameFromResourcePath(String resource);  }
@Test public void testGetPackageName(){ Assert.assertEquals("", ResourceList.getParentPackageName("")); Assert.assertEquals("", ResourceList.getParentPackageName("foo")); Assert.assertEquals("foo", ResourceList.getParentPackageName("foo.bar")); Assert.assertEquals("bar.foo", ResourceList.getParentPackageName("bar.foo.evo")); }