ClassLoaderPool { public static String getContextName(ClassLoader classLoader) { if (classLoader == null) { return "null"; } String contextName = _contextNames.get(classLoader); if (contextName == null) { contextName = "null"; } return contextName; }  static ClassLoader getClassLoader(String contextName); static String getContextName(ClassLoader classLoader); static void register(String contextName, ClassLoader classLoader); static void unregister(ClassLoader classLoader); static void unregister(String contextName);  }
@Test public void testGetContextName() { ClassLoader classLoader = new URLClassLoader(new URL[0]); ClassLoaderPool.register(_CONTEXT_NAME_1, classLoader); Assert.assertEquals("null", ClassLoaderPool.getContextName(null)); Assert.assertEquals( _CONTEXT_NAME_1, ClassLoaderPool.getContextName(classLoader)); Assert.assertEquals( "null", ClassLoaderPool.getContextName(new URLClassLoader(new URL[0]))); }