@Test public void testFindResource() throws Exception { String resource = getClass().getName().replace('.', '/') + ".class"; Bundle bundle = mock(Bundle.class); BundleDelegatingClassLoader classLoader = new BundleDelegatingClassLoader(bundle, getClass().getClassLoader()); assertThat(classLoader.findResource(resource), notNullValue()); verify(bundle).getResource(eq(resource)); }
protected URL findResource(String name) { URL resource = bundle.getResource(name); if (classLoader != null && resource == null) { resource = classLoader.getResource(name); } return resource; }
BundleDelegatingClassLoader extends ClassLoader { protected URL findResource(String name) { URL resource = bundle.getResource(name); if (classLoader != null && resource == null) { resource = classLoader.getResource(name); } return resource; } }
BundleDelegatingClassLoader extends ClassLoader { protected URL findResource(String name) { URL resource = bundle.getResource(name); if (classLoader != null && resource == null) { resource = classLoader.getResource(name); } return resource; } BundleDelegatingClassLoader(Bundle bundle);  BundleDelegatingClassLoader(Bundle bundle, ClassLoader classLoader); }
BundleDelegatingClassLoader extends ClassLoader { protected URL findResource(String name) { URL resource = bundle.getResource(name); if (classLoader != null && resource == null) { resource = classLoader.getResource(name); } return resource; } BundleDelegatingClassLoader(Bundle bundle);  BundleDelegatingClassLoader(Bundle bundle, ClassLoader classLoader); Bundle getBundle(); @Override String toString(); }
BundleDelegatingClassLoader extends ClassLoader { protected URL findResource(String name) { URL resource = bundle.getResource(name); if (classLoader != null && resource == null) { resource = classLoader.getResource(name); } return resource; } BundleDelegatingClassLoader(Bundle bundle);  BundleDelegatingClassLoader(Bundle bundle, ClassLoader classLoader); Bundle getBundle(); @Override String toString();  }