BundleFinder { public List<Bundle> findBundles() { List<Bundle> bundles = new ArrayList<Bundle>(); for (Bundle bundle : bundleContext.getBundles()) { String symbolicName = bundle.getSymbolicName(); if (matcher.matches(symbolicName)) { LOG.debug("Bundle {} has been found.", symbolicName); bundles.add(bundle); } } return bundles; } BundleFinder(BundleInfo bundleInfo, BundleContext bundleContext); List<Bundle> findBundles();  }
@Test public void testFindBundles() throws Exception { BundleFinder bundleFinder = new BundleFinder(bundleInfo, bundleContext); List<Bundle> bundles = bundleFinder.findBundles(); Assert.assertEquals(bundles.size(), 1); Assert.assertEquals(bundles.get(0), matchingBundle); }