StatisticsProviderFactory { @Activate private void activate(BundleContext context, Configuration config) { this.bundleContext = context; statisticsProvider = createProvider(config.providerType()); if (statisticsProvider != null) { regs.add(context.registerService(StatisticsProvider.class.getName(), statisticsProvider, null)); } }    }
@Test public void noneMode() throws Exception { MockOsgi.activate(service, context.bundleContext(), ImmutableMap.<String, Object>of("providerType", "NONE")); assertNull(context.getService(StatisticsProvider.class)); }
@Test public void defaultMode() throws Exception { MockOsgi.activate(service, context.bundleContext(), ImmutableMap.<String, Object>of("providerType", "DEFAULT")); assertTrue(context.getService(StatisticsProvider.class) instanceof DefaultStatisticsProvider); }