BundleClassesFinder { public Collection<Class<?>> traverseBundlesForOsgiServices(final Collection<Bundle> bundles) { Collection<Class<?>> allClasses = getClasses(bundles); Set<Class<?>> osgiClasses = new HashSet<Class<?>>(); for (Class<?> clazz : allClasses) { Set<Class<?>> osgiServicesForClass = readOsgiServicesForClass(clazz); osgiClasses.addAll(osgiServicesForClass); } return osgiClasses; } BundleClassesFinder(String basePackage); Collection<Class<?>> getClasses(final Bundle bundle); Collection<Class<?>> getClasses(final Collection<Bundle> bundles); void addFilter(ClassFilter classFilter); Collection<Class<?>> traverseBundlesForOsgiServices(final Collection<Bundle> bundles);  }
@Test public void testTraverseBundlesForOsgiServices() throws ClassNotFoundException { bundleSetup(); Collection<Class<?>> classes = classFinder.traverseBundlesForOsgiServices(Lists.newArrayList(bundle)); Assert.assertEquals(classes.size(), 1); Assert.assertEquals("Long", new ArrayList<Class<?>>(classes).get(0).getSimpleName()); }