OSGIServiceLoader implements BundleListener { public BundleContext getBundleContext() { return context; } OSGIServiceLoader(BundleContext context); BundleContext getBundleContext(); Set<Bundle> getResourceBundles(); @Override void bundleChanged(BundleEvent bundleEvent);  }
@Test public void testGetBundleContext() { BundleContext mockBundleContext = new MockBundleContext(); OSGIServiceLoader instance = new OSGIServiceLoader(mockBundleContext); BundleContext result = instance.getBundleContext(); assertThat(result).isEqualTo(mockBundleContext); }