AspectFactory factory = def.getFactory();
Object global = factory.createPerVM();
assertSame(getClass().getClassLoader(), global.getClass().getClassLoader());
AspectFactoryWithClassLoader factoryCl = assertInstanceOf(factory, AspectFactoryWithClassLoader.class);
factoryCl.pushScopedClassLoader(loader);
try
{
Object scoped = factory.createPerVM();
ClassLoader scopedLoader = scoped.getClass().getClassLoader();
assertSame(loader, scopedLoader);
}
finally
{
factoryCl.popScopedClassLoader();
}
}