{
ClassLoaderSystem system = createClassLoaderSystemWithModifiedBootstrap();
TestClassLoaderPolicy policy1 = new TestClassLoaderPolicy();
TestClassLoaderPolicy policy2 = new TestClassLoaderPolicy();
TestClassLoaderPolicyFactory factory2 = new TestClassLoaderPolicyFactory(policy2, false);
policy1.delegates = Collections.singletonList(new FilteredDelegateLoader(factory2));
ClassLoader classLoader = system.registerClassLoaderPolicy(policy1);
system.registerClassLoaderPolicy(policy2);
assertLoadClassFail(ClassLoaderDomain.class, classLoader);
assertNotNull("Should have tried policy1 ", policy1.getResourceInvoked);
assertNull("Should have tried policy2 ", policy2.getResourceInvoked);
factory2.setCanCreate(true);
policy1.getResourceInvoked = null;
assertLoadClassFail(ClassLoaderDomain.class, classLoader);
assertNull("Should NOT have tried policy1 ", policy1.getResourceInvoked);
assertNotNull("Should have tried policy2 ", policy2.getResourceInvoked);
}