@Test
public void testGetResource() {

    MockBundleContext mockBundleContext = new MockBundleContext();
    OSGIServiceLoader loader = new OSGIServiceLoader(mockBundleContext);
    MockBundle startedBundle = new MockBundle();
    startedBundle.setState(Bundle.ACTIVE);
    startedBundle.setBundleId(1);
    startedBundle.setBundleContext(mockBundleContext);
    mockBundleContext.installBundle(startedBundle);
    OSGIServiceContext instance = new OSGIServiceContext(loader);
    URL resource = instance.getResource("mockbundle.service");
    assertThat(resource).isNotNull();
    assertThat(resource.toString()).contains("mockbundle.service");
}