### Question:
FelixOsgiContainerManager implements OsgiContainerManager { void detectXercesOverride(String systemExports) throws OsgiContainerException { int pos = systemExports.indexOf("org.apache.xerces.util"); if (pos > -1) { if (pos == 0 || (pos > 0 && systemExports.charAt(pos - 1) == ',')) { pos += "org.apache.xerces.util".length(); if (pos >= systemExports.length() || ';' != systemExports.charAt(pos)) { throw new OsgiContainerException( "Detected an incompatible version of Apache Xerces on the classpath. If using Tomcat, you may have " + "an old version of Xerces in $TOMCAT_HOME/common/lib/endorsed that will need to be removed."); } } } } @Deprecated  FelixOsgiContainerManager(final File frameworkBundlesDir, final PackageScannerConfiguration packageScannerConfig, final HostComponentProvider provider, final PluginEventManager eventManager); @Deprecated  FelixOsgiContainerManager(final URL frameworkBundlesZip, final File frameworkBundlesDir, final PackageScannerConfiguration packageScannerConfig, final HostComponentProvider provider, final PluginEventManager eventManager);  FelixOsgiContainerManager(final OsgiPersistentCache persistentCache, final PackageScannerConfiguration packageScannerConfig, final HostComponentProvider provider, final PluginEventManager eventManager);  FelixOsgiContainerManager(final URL frameworkBundlesZip, OsgiPersistentCache persistentCache,
                                     final PackageScannerConfiguration packageScannerConfig,
                                     final HostComponentProvider provider, final PluginEventManager eventManager); void setFelixLogger(final Logger logger); void setDisableMultipleBundleVersions(final boolean val); @SuppressWarnings({"UnusedDeclaration"}) @PluginEventListener void onStart(final PluginFrameworkStartingEvent event); @SuppressWarnings({"UnusedDeclaration"}) @PluginEventListener void onShutdown(final PluginFrameworkShutdownEvent event); @SuppressWarnings({"UnusedDeclaration"}) @PluginEventListener void onPluginUpgrade(PluginUpgradedEvent event); @SuppressWarnings({"UnusedDeclaration"}) @PluginEventListener void onPluginUninstallation(PluginUninstalledEvent event); @SuppressWarnings({"UnusedDeclaration"}) @PluginEventListener void onPluginFrameworkWarmRestarting(PluginFrameworkWarmRestartingEvent event); void start(); void stop(); Bundle[] getBundles(); ServiceReference[] getRegisteredServices(); ServiceTracker getServiceTracker(final String cls); Bundle installBundle(final File file); boolean isRunning(); List<HostComponentRegistration> getHostComponentRegistrations(); static final String OSGI_FRAMEWORK_BUNDLES_ZIP; static final int REFRESH_TIMEOUT; }### Answer:
@Test public void testDetectXercesOverride() { felix.detectXercesOverride("foo.bar,baz.jim"); felix.detectXercesOverride("foo.bar,org.apache.xerces.util;version=\"1.0\",baz.jim"); felix.detectXercesOverride("foo.bar,org.apache.xerces.util;version=\"1.0\""); felix.detectXercesOverride("foo.bar,repackaged.org.apache.xerces.util,bar.baz"); try { felix.detectXercesOverride("foo.bar,org.apache.xerces.util"); fail("Should fail validation"); } catch (OsgiContainerException ignored) { } try { felix.detectXercesOverride("org.apache.xerces.util"); fail("Should fail validation"); } catch (OsgiContainerException ignored) { } try { felix.detectXercesOverride("org.apache.xerces.util,bar.baz"); fail("Should fail validation"); } catch (OsgiContainerException ignored) { } }