@Test
  public void testServlets() throws Exception {
    final Injector injector = GuiceInjectorBuilder.getInjector(new CronGuiModulesMock());
    final CronGuiActivator activator =
        new CronGuiActivator() {

          @Override
          public Injector getInjector() {
            return injector;
          }
        };
    final BundleActivatorTestUtil bundleActivatorTestUtil = new BundleActivatorTestUtil();
    final ExtHttpServiceMock extHttpServiceMock = bundleActivatorTestUtil.startBundle(activator);
    final List<String> paths = new ArrayList<String>();
    paths.add("/" + CronGuiConstants.NAME + CronGuiConstants.URL_HOME);
    paths.add("/" + CronGuiConstants.NAME + CronGuiConstants.URL_LIST);
    paths.add("/" + CronGuiConstants.NAME + CronGuiConstants.URL_CRON_TRIGGER);
    paths.add("/" + CronGuiConstants.NAME + CronGuiConstants.URL_LATEST);
    paths.add("/" + CronGuiConstants.NAME + CronGuiConstants.URL_MANAGE);
    assertEquals(paths.size(), extHttpServiceMock.getRegisterServletCallCounter());
    for (final String path : paths) {
      assertTrue(
          "no servlet for path " + path + " registered", extHttpServiceMock.hasServletPath(path));
    }
  }
  @Test
  public void testFilters() throws Exception {
    final Injector injector = GuiceInjectorBuilder.getInjector(new CronGuiModulesMock());
    final CronGuiActivator activator =
        new CronGuiActivator() {

          @Override
          public Injector getInjector() {
            return injector;
          }
        };

    final BundleActivatorTestUtil bundleActivatorTestUtil = new BundleActivatorTestUtil();
    final ExtHttpServiceMock extHttpServiceMock = bundleActivatorTestUtil.startBundle(activator);
    final List<String> paths = Arrays.asList("/cron.*");
    assertEquals(paths.size(), extHttpServiceMock.getRegisterFilterCallCounter());
    for (final String path : paths) {
      assertTrue(
          "no filter for path " + path + " registered", extHttpServiceMock.hasFilterPath(path));
    }

    final BaseGuiceFilter guiceFilter = injector.getInstance(BaseGuiceFilter.class);
    for (final Filter filter : Arrays.asList(guiceFilter)) {
      assertTrue("no filter " + filter + " registered", extHttpServiceMock.hasFilter(filter));
    }
  }
  @Test
  public void testServices() throws Exception {
    final Injector injector = GuiceInjectorBuilder.getInjector(new CronGuiModulesMock());
    final CronGuiActivator activator =
        new CronGuiActivator() {

          @Override
          public Injector getInjector() {
            return injector;
          }
        };

    final BundleActivatorTestUtil bundleActivatorTestUtil = new BundleActivatorTestUtil();
    bundleActivatorTestUtil.startBundle(activator);

    final Collection<ServiceInfo> serviceInfos = activator.getServiceInfos();
    final List<String> names = new ArrayList<String>();
    names.add(NavigationEntry.class.getName());
    assertEquals(names.size(), serviceInfos.size());
    for (final String name : names) {
      boolean match = false;
      for (final ServiceInfo serviceInfo : serviceInfos) {
        if (name.equals(serviceInfo.getName())) {
          match = true;
        }
      }
      assertTrue("no service with name: " + name + " found", match);
    }
  }
 @Test
 public void testSingleton() throws Exception {
   final Injector injector = GuiceInjectorBuilder.getInjector(new StorageModulesMock());
   final StorageServiceMemory a = injector.getInstance(StorageServiceMemory.class);
   final StorageServiceMemory b = injector.getInstance(StorageServiceMemory.class);
   assertEquals(a, b);
   assertEquals(a.hashCode(), b.hashCode());
 }
 @Test
 public void testSingleton() {
   final Injector injector = GuiceInjectorBuilder.getInjector(new AuthenticationGuiModulesMock());
   final AuthenticationGuiLoginServlet a =
       injector.getInstance(AuthenticationGuiLoginServlet.class);
   final AuthenticationGuiLoginServlet b =
       injector.getInstance(AuthenticationGuiLoginServlet.class);
   assertEquals(a, b);
   assertEquals(a.hashCode(), b.hashCode());
   assertEquals(a, b);
 }
  @Test
  public void testResources() throws Exception {
    final Injector injector = GuiceInjectorBuilder.getInjector(new CronGuiModulesMock());
    final CronGuiActivator activator =
        new CronGuiActivator() {

          @Override
          public Injector getInjector() {
            return injector;
          }
        };
    final BundleActivatorTestUtil bundleActivatorTestUtil = new BundleActivatorTestUtil();
    final ExtHttpServiceMock extHttpServiceMock = bundleActivatorTestUtil.startBundle(activator);
    final List<String> paths = new ArrayList<String>();
    assertEquals(paths.size(), extHttpServiceMock.getRegisterResourceCallCounter());
    for (final String path : paths) {
      assertTrue(
          "no resource for path " + path + " registered", extHttpServiceMock.hasResource(path));
    }
  }
 @Test
 public void testInject() {
   final Injector injector = GuiceInjectorBuilder.getInjector(new AuthorizationModulesMock());
   assertNotNull(injector.getInstance(PermissionBeanMapper.class));
 }
 @Test
 public void testInject() {
   final Injector injector = GuiceInjectorBuilder.getInjector(new CronGuiModulesMock());
   final CronGuiActivator activator = injector.getInstance(CronGuiActivator.class);
   assertNotNull(activator);
 }
 @org.junit.Test
 public void testInject() {
   final Injector injector = GuiceInjectorBuilder.getInjector(new StorageModulesMock());
   assertNotNull(injector.getInstance(StorageServiceMemory.class));
 }
 @Test
 public void testInject() {
   final Injector injector = GuiceInjectorBuilder.getInjector(new SeleniumModulesMock());
   assertThat(injector.getInstance(SeleniumCoreConfigurationExecutor.class), is(notNullValue()));
 }