}
@Test
public void testCollectionsReturnUnwrappedResultsIfUnwrappedTypeIsCompatible() throws Exception
{
AddonRegistry registry = LocalServices.getFurnace(getClass().getClassLoader())
.getAddonRegistry();
ClassLoader thisLoader = CLACProxiedCollectionsReturnTypeUnwrappingTest.class.getClassLoader();
ClassLoader dep1Loader = registry.getAddon(AddonId.from("dep1", "1")).getClassLoader();
ClassLoader dep2Loader = registry.getAddon(AddonId.from("dep2", "2")).getClassLoader();
Class<?> foreignProfileType = dep1Loader.loadClass(ProfileFactory.class.getName());
Object delegate = foreignProfileType.newInstance();
ProfileFactory factory = (ProfileFactory) ClassLoaderAdapterBuilder.callingLoader(thisLoader)
.delegateLoader(dep1Loader).whitelist(Sets.toSet(Arrays.asList(dep1Loader, dep2Loader)))