### Question:
OsgiClassLoaderManager implements ClassLoaderManager { @Override public ClassLoader getClassLoader(String resourceName) { if (resourceName == null || resourceName.length() < 2) { return resourceClassLoader(resourceName); } String normalizedName = resourceName.charAt(0) == '/' ? resourceName.substring(1) : resourceName; if (normalizedName.startsWith(CAYENNE_PACKAGE)) { return (normalizedName.substring(CAYENNE_PACKAGE.length()).startsWith(CAYENNE_DI_PACKAGE_SUFFIX)) ? cayenneDiClassLoader() : cayenneServerClassLoader(); } return resourceClassLoader(resourceName); } OsgiClassLoaderManager(ClassLoader applicationClassLoader, Map<String, ClassLoader> perResourceClassLoaders); @Override ClassLoader getClassLoader(String resourceName);  }### Answer:
@Test public void testGetClassLoader() { final ClassLoader appCl = mock(ClassLoader.class); final ClassLoader diCl = mock(ClassLoader.class); final ClassLoader serverCl = mock(ClassLoader.class); OsgiClassLoaderManager manager = new OsgiClassLoaderManager(appCl, Collections.<String, ClassLoader> emptyMap()) { @Override protected ClassLoader cayenneDiClassLoader() { return diCl; } @Override protected ClassLoader cayenneServerClassLoader() { return serverCl; } }; assertSame(appCl, manager.getClassLoader(null)); assertSame(appCl, manager.getClassLoader("")); assertSame(appCl, manager.getClassLoader("org/example/test")); assertSame(appCl, manager.getClassLoader("/org/example/test")); assertSame(serverCl, manager.getClassLoader("/org/apache/cayenne/access/DataContext.class")); assertSame(diCl, manager.getClassLoader("/org/apache/cayenne/di/Injector.class")); assertSame(diCl, manager.getClassLoader("org/apache/cayenne/di/Injector.class")); }