BundleDelegatingClassLoader extends ClassLoader { protected Class<?> findClass(String name) throws ClassNotFoundException { return bundle.loadClass(name); } BundleDelegatingClassLoader(Bundle bundle);  BundleDelegatingClassLoader(Bundle bundle, ClassLoader classLoader); Bundle getBundle(); @Override String toString();  }
@Test public void testFindClass() throws Exception { Bundle bundle = mock(Bundle.class); BundleDelegatingClassLoader classLoader = new BundleDelegatingClassLoader(bundle, null); classLoader.findClass(getClass().getName()); verify(bundle).loadClass(eq(getClass().getName())); }