final ResourceResolverContext ctx = new ResourceResolverContext(false, null, new ResourceAccessSecurityTracker());
final SortedProviderList<Adaptable> spl = new SortedProviderList<Adaptable>(Adaptable.class);
check(spl, ctx);
spl.add(new ResourceProviderFactoryHandler(new ResourceProviderFactoryImpl(rp1), rp1.getProperties()));
check(spl, ctx);
spl.add(new ResourceProviderFactoryHandler(new ResourceProviderFactoryImpl(rp2), rp2.getProperties()));
check(spl, ctx, rp2);
spl.add(new ResourceProviderFactoryHandler(new ResourceProviderFactoryImpl(rp3), rp3.getProperties()));
check(spl, ctx, rp2, rp3);
spl.add(new ResourceProviderFactoryHandler(new ResourceProviderFactoryImpl(rp4), rp4.getProperties()));
check(spl, ctx, rp2, rp3);
spl.remove(new ResourceProviderFactoryHandler(new ResourceProviderFactoryImpl(rp1), rp1.getProperties()));
check(spl, ctx, rp2, rp3);
spl.remove(new ResourceProviderFactoryHandler(new ResourceProviderFactoryImpl(rp1), rp1.getProperties()));
check(spl, ctx, rp2, rp3);
spl.remove(new ResourceProviderFactoryHandler(new ResourceProviderFactoryImpl(rp4), rp4.getProperties()));
check(spl, ctx, rp2, rp3);
spl.remove(new ResourceProviderFactoryHandler(new ResourceProviderFactoryImpl(rp2), rp2.getProperties()));
check(spl, ctx, rp3);
spl.remove(new ResourceProviderFactoryHandler(new ResourceProviderFactoryImpl(rp3), rp3.getProperties()));
check(spl, ctx);
}