### Question:
OSGIPluginRegistryExtension implements PluginRegistryExtension { public synchronized void init( final PluginRegistry registry ) { if ( PentahoSystem.getInitializedStatus() != PentahoSystem.SYSTEM_INITIALIZED_OK && !initializedKaraf.getAndSet( true )) { String userDir = System.getProperty("pentaho.user.dir", "."); IApplicationContext context = new StandaloneApplicationContext( userDir, userDir ); PentahoSystem.init(context); boot.startup( null ); } PluginRegistry.addPluginType( OSGIPluginType.getInstance() ); tracker.registerPluginClass( PluginInterface.class ); tracker.addPluginLifecycleListener( PluginInterface.class, new PluginRegistryOSGIServiceLifecycleListener( registry ) ); } OSGIPluginRegistryExtension(); static OSGIPluginRegistryExtension getInstance(); KarafBoot getKarafBoot(); synchronized void init( final PluginRegistry registry ); @Override void searchForType( PluginTypeInterface pluginType ); @Override String getPluginId( Class<? extends PluginTypeInterface> pluginType, Object pluginClass );  }### Answer:
@Test public void testInit() { PluginRegistry registry = mock( PluginRegistry.class ); when( kettleClientEnvironmentInitialized.get() ).thenReturn( true ); OSGIPluginRegistryExtension.getInstance().init( registry ); verify( karafBoot ).startup( null ); verify( tracker ).registerPluginClass( PluginInterface.class ); verify( tracker ).addPluginLifecycleListener( any( Class.class ), any( PluginRegistryOSGIServiceLifecycleListener.class ) ); }