### Question:
OsgiPluginUninstalledHelper implements OsgiPluginHelper { public Bundle install() { Bundle bundle = osgiContainerManager.installBundle(pluginArtifact.toFile()); if (!OsgiHeaderUtil.getPluginKey(bundle).equals(key)) { throw new IllegalArgumentException("The plugin key '" + key + "' must either match the OSGi bundle symbolic " + "name (Bundle-SymbolicName) or be specified in the Maera-Plugin-Key manifest header"); } return bundle; } OsgiPluginUninstalledHelper(String key, final OsgiContainerManager mgr, final PluginArtifact artifact); Bundle getBundle(); Class<T> loadClass(String clazz, Class<?> callingClass); URL getResource(String name); InputStream getResourceAsStream(String name); ClassLoader getClassLoader(); Bundle install(); void onEnable(ServiceTracker... serviceTrackers); void onDisable(); void onUninstall(); void autowire(Object instance, AutowireCapablePlugin.AutowireStrategy autowireStrategy); T autowire(Class<T> clazz, AutowireCapablePlugin.AutowireStrategy autowireStrategy); Set<String> getRequiredPlugins(); void setPluginContainer(Object container); ContainerAccessor getContainerAccessor();  }### Answer:
@Test public void testInstall() { Dictionary<String, String> dict = new Hashtable<String, String>(); dict.put(OsgiPlugin.MAERA_PLUGIN_KEY, key); Bundle bundle = mock(Bundle.class); when(bundle.getHeaders()).thenReturn(dict); when(bundle.getSymbolicName()).thenReturn(key); when(mgr.installBundle(null)).thenReturn(bundle); assertEquals(bundle, helper.install()); }
@Test(expected = IllegalArgumentException.class) public void testInstallDifferentSymbolicName() { Dictionary<String, String> dict = new Hashtable<String, String>(); Bundle bundle = mock(Bundle.class); when(bundle.getHeaders()).thenReturn(dict); when(bundle.getSymbolicName()).thenReturn("bar"); when(mgr.installBundle(null)).thenReturn(bundle); helper.install(); }
@Test public void testInstallDifferentSymbolicNameButAltassianKeyFound() { Dictionary<String, String> dict = new Hashtable<String, String>(); dict.put(OsgiPlugin.MAERA_PLUGIN_KEY, key); Bundle bundle = mock(Bundle.class); when(bundle.getHeaders()).thenReturn(dict); when(bundle.getSymbolicName()).thenReturn("bar"); when(mgr.installBundle(null)).thenReturn(bundle); helper.install(); }