OSGIServiceContext implements ServiceContext { public boolean isInitialized(){ return osgiServiceLoader != null; } OSGIServiceContext(OSGIServiceLoader osgiServiceLoader); boolean isInitialized(); @Override ClassLoader getClassLoader(); @Override void init(ClassLoader classLoader); @Override int ordinal(); @Override T getService(Class<T> serviceType, Supplier<T> supplier); @Override T create(Class<T> serviceType, Supplier<T> supplier); @Override List<T> getServices(Class<T> serviceType, Supplier<List<T>> supplier); @Override Collection<URL> getResources(String resource); @Override URL getResource(String resource); @Override T register(Class<T> serviceType, T instance, boolean force); @Override List<T> register(Class<T> serviceType, List<T> instances, boolean force); @Override void reset();  }
@Test public void testIsInitialized() { OSGIServiceContext instance = new OSGIServiceContext(Mockito.mock(OSGIServiceLoader.class)); assertThat(instance.isInitialized()).isTrue(); }