}
public void testGetResourcesFromCache() throws Exception
{
ClassLoaderSystem system = createClassLoaderSystem();
CountingClassLoaderPolicy policy = MockClassLoaderHelper.createMockCountingClassLoaderPolicy(null);
policy.setImportAll(true);
policy.setPrefix("a/");
policy.setPath("com/acme/p1");
policy.setPackageNames("com.acme.p1");
ClassLoader classLoader = system.registerClassLoaderPolicy(policy);
assertGetResources("com/acme/p1/testResource", classLoader, "a/");
assertEquals(1, policy.getGetResourcesCounter());
// should hit cache from getResources
assertGetResource("a/", "com/acme/p1/testResource", classLoader);
assertEquals(0, policy.getGetResourceCounter());
// 2nd try -- should hit cache
assertGetResources("com/acme/p1/testResource", classLoader, "a/");
assertEquals(1, policy.getGetResourcesCounter());
}