assertClassEquality(fromB, fromA);
}
public void testAbstractFactoryWrongWay() throws Exception
{
ClassLoaderSystem system = createClassLoaderSystemWithModifiedBootstrap();
MockClassLoaderPolicy pb = createMockClassLoaderPolicy("B");
pb.setPaths(TestB1.class);
MockClassLoaderPolicy pa = createMockClassLoaderPolicy("A");
pa.setPaths(TestA1.class);
List<DelegateLoader> delegates = new ArrayList<DelegateLoader>();
delegates.add(new FilteredDelegateLoader(pa));
delegates.add(new FilteredDelegateLoader(pb));
pa.setDelegates(delegates);
pb.setDelegates(delegates);
ClassLoader a = system.registerClassLoaderPolicy(pa);
ClassLoader b = system.registerClassLoaderPolicy(pb);
Class<?> testAbstractFactoryClass = assertLoadClass(TestAbstractFactory.class, b, a);
Method method = testAbstractFactoryClass.getMethod("getInstance", (Class[]) null);
Object instance = method.invoke(null, (Object[]) null);
Class<?> testFactoryImplementationClass = assertLoadClass(TestFactoryImplementation.class, a, b);