### Question:
BundleScriptEngineResolver implements ScriptEngineResolver { public void register() { if (bundle.getBundleContext() != null) { reg = bundle.getBundleContext().registerService( ScriptEngineResolver.class, this, null); } } BundleScriptEngineResolver(Bundle bundle, URL configFile); void register(); void unregister(); @Override ScriptEngine resolveScriptEngine(String name); @Override String toString();  }### Answer:
@SuppressWarnings("unchecked") @Test public void register() { Bundle bundle = mock(Bundle.class); BundleContext bundleContext = mock(BundleContext.class); when(bundle.getBundleContext()).thenReturn(bundleContext); BundleScriptEngineResolver scriptEngineResolver = new BundleScriptEngineResolver(bundle, null); scriptEngineResolver.register(); verify(bundleContext).registerService(eq(ScriptEngineResolver.class), eq(scriptEngineResolver), isNull(Dictionary.class)); }