com.google.inject.Guice Java Examples

The following examples show how to use com.google.inject.Guice. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BaseIT.java    From kafka-pubsub-emulator with Apache License 2.0 6 votes vote down vote up
private static Injector getInjector() throws IOException {
  File serverConfig = TEMPORARY_FOLDER.newFile();
  File pubSubRepository = TEMPORARY_FOLDER.newFile();
  Files.write(pubSubRepository.toPath(), Configurations.PUBSUB_CONFIG_JSON.getBytes(UTF_8));

  if (!USE_SSL) {
    Files.write(serverConfig.toPath(), Configurations.SERVER_CONFIG_JSON.getBytes(UTF_8));
  } else {
    // Update certificate paths
    String updated =
        Configurations.SSL_SERVER_CONFIG_JSON
            .replace("/path/to/server.crt", ClassLoader.getSystemResource("server.crt").getPath())
            .replace(
                "/path/to/server.key", ClassLoader.getSystemResource("server.key").getPath());
    Files.write(serverConfig.toPath(), updated.getBytes(UTF_8));
  }
  return Guice.createInjector(
      new DefaultModule(serverConfig.getPath(), pubSubRepository.getPath()));
}
 
Example #2
Source File: ConfigurationModuleTest.java    From hivemq-community-edition with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp() throws Exception {

    MockitoAnnotations.initMocks(this);

    testConfigurationBootstrap = new TestConfigurationBootstrap();
    final FullConfigurationService fullConfigurationService = testConfigurationBootstrap.getFullConfigurationService();

    injector = Guice.createInjector(new SystemInformationModule(new SystemInformationImpl()), new ConfigurationModule(fullConfigurationService, new HivemqId()),
            new AbstractModule() {
                @Override
                protected void configure() {
                    bind(SharedSubscriptionService.class).toInstance(sharedSubscriptionService);
                }
            });
}
 
Example #3
Source File: HiveMQMainModuleTest.java    From hivemq-community-edition with Apache License 2.0 6 votes vote down vote up
@Test
public void test_topic_matcher_not_same() {

    final Injector injector = Guice.createInjector(Stage.PRODUCTION,
            new HiveMQMainModule(),
            new AbstractModule() {
                @Override
                protected void configure() {
                    bind(EventExecutorGroup.class).toInstance(Mockito.mock(EventExecutorGroup.class));
                }
            });

    final TopicMatcher instance1 = injector.getInstance(TopicMatcher.class);
    final TopicMatcher instance2 = injector.getInstance(TopicMatcher.class);

    assertNotSame(instance1, instance2);

}
 
Example #4
Source File: AbstractArchiveTest.java    From opt4j with MIT License 6 votes vote down vote up
@Test
public void update() {
	Injector injector = Guice.createInjector(new MockProblemModule());
	IndividualFactory factory = injector.getInstance(IndividualFactory.class);

	Objective o0 = new Objective("o0");
	Objective o1 = new Objective("o1");

	TestArchive archive = new TestArchive();

	Individual i0 = factory.create();
	Objectives objectives0 = new Objectives();
	objectives0.add(o0, 1);
	objectives0.add(o1, 0);
	i0.setObjectives(objectives0);

	Assert.assertTrue(archive.update(i0));
	Assert.assertTrue(archive.contains(i0));
}
 
Example #5
Source File: JavaPluginLoader.java    From Velocity with MIT License 6 votes vote down vote up
@Override
public PluginContainer createPlugin(PluginDescription description) throws Exception {
  if (!(description instanceof JavaVelocityPluginDescription)) {
    throw new IllegalArgumentException("Description provided isn't of the Java plugin loader");
  }

  JavaVelocityPluginDescription javaDescription = (JavaVelocityPluginDescription) description;
  Optional<Path> source = javaDescription.getSource();

  if (!source.isPresent()) {
    throw new IllegalArgumentException("No path in plugin description");
  }

  Injector injector = Guice
      .createInjector(new VelocityPluginModule(server, javaDescription, baseDirectory));
  Object instance = injector.getInstance(javaDescription.getMainClass());

  if (instance == null) {
    throw new IllegalStateException(
        "Got nothing from injector for plugin " + javaDescription.getId());
  }

  return new VelocityPluginContainer(description, instance);
}
 
Example #6
Source File: PersistenceMigrationModuleTest.java    From hivemq-community-edition with Apache License 2.0 6 votes vote down vote up
@Test
public void test_memory_persistence() {
    when(persistenceConfigurationService.getMode()).thenReturn(PersistenceConfigurationService.PersistenceMode.IN_MEMORY);

    final Injector injector = Guice.createInjector(
            new PersistenceMigrationModule(new MetricRegistry(), persistenceConfigurationService),
            new AbstractModule() {
                @Override
                protected void configure() {
                    bind(SystemInformation.class).toInstance(systemInformation);
                    bindScope(LazySingleton.class, LazySingletonScope.get());
                    bind(MqttConfigurationService.class).toInstance(mqttConfigurationService);
                }
            });

    assertTrue(injector.getInstance(RetainedMessageLocalPersistence.class) instanceof RetainedMessageMemoryLocalPersistence);
    assertTrue(injector.getInstance(PublishPayloadLocalPersistence.class) instanceof PublishPayloadMemoryLocalPersistence);
}
 
Example #7
Source File: DefaultGLSPServerLauncher.java    From graphical-lsp with Eclipse Public License 2.0 6 votes vote down vote up
private void createClientConnection(AsynchronousSocketChannel socketChannel) {
	Injector injector = Guice.createInjector(getGLSPModule());
	GsonConfigurator gsonConf = injector.getInstance(GsonConfigurator.class);

	InputStream in = Channels.newInputStream(socketChannel);
	OutputStream out = Channels.newOutputStream(socketChannel);

	Consumer<GsonBuilder> configureGson = (GsonBuilder builder) -> gsonConf.configureGsonBuilder(builder);
	Function<MessageConsumer, MessageConsumer> wrapper = Function.identity();
	GLSPServer languageServer = injector.getInstance(GLSPServer.class);

	Launcher<GLSPClient> launcher = Launcher.createIoLauncher(languageServer, GLSPClient.class, in, out, threadPool,
			wrapper, configureGson);
	languageServer.connect(launcher.getRemoteProxy());
	launcher.startListening();

	try {
		SocketAddress remoteAddress = socketChannel.getRemoteAddress();
		log.info("Started language server for client " + remoteAddress);
	} catch (IOException ex) {
		log.error("Failed to get the remoteAddress for the new client connection: " + ex.getMessage(), ex);
	}
}
 
Example #8
Source File: CrowdingArchiveTest.java    From opt4j with MIT License 6 votes vote down vote up
@Before
public void setUp() throws Exception {

	Objective o0 = new Objective("o0");
	Objective o1 = new Objective("o1");

	Injector injector = Guice.createInjector(new MockProblemModule());
	IndividualFactory factory = injector.getInstance(IndividualFactory.class);

	for (int i = 0; i < SIZE; i++) {
		Individual individual = factory.create();
		Objectives objectives = new Objectives();
		objectives.add(o0, i);
		objectives.add(o1, SIZE - i);
		individual.setObjectives(objectives);
		set.add(individual);
	}
}
 
Example #9
Source File: AbstractHealthServiceTest.java    From cassandra-sidecar with Apache License 2.0 6 votes vote down vote up
@BeforeEach
void setUp() throws InterruptedException
{
    Injector injector = Guice.createInjector(Modules.override(new MainModule()).with(getTestModule()));
    server = injector.getInstance(HttpServer.class);

    check = injector.getInstance(MockHealthCheck.class);
    service = injector.getInstance(HealthService.class);
    vertx = injector.getInstance(Vertx.class);
    config = injector.getInstance(Configuration.class);

    VertxTestContext context = new VertxTestContext();
    server.listen(config.getPort(), context.completing());

    context.awaitCompletion(5, TimeUnit.SECONDS);
}
 
Example #10
Source File: Initializer.java    From hmdm-server with Apache License 2.0 6 votes vote down vote up
protected Injector getInjector() {
    boolean success = false;

    final StringWriter errorOut = new StringWriter();
    PrintWriter errorWriter = new PrintWriter(errorOut);
    try {
        this.injector = Guice.createInjector(Stage.PRODUCTION, this.getModules());
        success = true;
    } catch (Exception e){
        System.err.println("[HMDM-INITIALIZER]: Unexpected error during injector initialization: " + e);
        e.printStackTrace();
        e.printStackTrace(errorWriter);
    }
    if (success) {
        System.out.println("[HMDM-INITIALIZER]: Application initialization was successful");
        onInitializationCompletion(null);
    } else {
        System.out.println("[HMDM-INITIALIZER]: Application initialization has failed");
        onInitializationCompletion(errorOut);
    }
    return injector;
}
 
Example #11
Source File: BslValidatorPlugin.java    From ru.capralow.dt.bslls.validator with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private Injector createInjector()
{
    try
    {
        return Guice.createInjector(new ExternalDependenciesModule(this));

    }
    catch (Exception e)
    {
        String msg = MessageFormat.format(Messages.BslValidator_Failed_to_create_injector_for_0,
            getBundle().getSymbolicName());
        log(createErrorStatus(msg, e));
        return null;

    }
}
 
Example #12
Source File: PubsubEmulatorServer.java    From kafka-pubsub-emulator with Apache License 2.0 6 votes vote down vote up
/**
 * Initialize and start the PubsubEmulatorServer.
 *
 * <p>To set an external configuration file must be considered argument
 * `configuration.location=/to/path/application.yaml` the properties will be merged.
 */
public static void main(String[] args) {
  Args argObject = new Args();
  JCommander jCommander = JCommander.newBuilder().addObject(argObject).build();
  jCommander.parse(args);
  if (argObject.help) {
    jCommander.usage();
    return;
  }
  Injector injector =
      Guice.createInjector(new DefaultModule(argObject.configurationFile, argObject.pubSubFile));
  PubsubEmulatorServer pubsubEmulatorServer = injector.getInstance(PubsubEmulatorServer.class);
  try {
    pubsubEmulatorServer.start();
    pubsubEmulatorServer.blockUntilShutdown();
  } catch (IOException | InterruptedException e) {
    logger.atSevere().withCause(e).log("Unexpected server failure");
  }
}
 
Example #13
Source File: IndividualCompleterModuleTest.java    From opt4j with MIT License 5 votes vote down vote up
@Test
public void configSequential() {
	IndividualCompleterModule module = new IndividualCompleterModule();
	module.setType(Type.SEQUENTIAL);

	Injector injector = Guice.createInjector(new MockProblemModule(), module);
	IndividualCompleter completer = injector.getInstance(IndividualCompleter.class);

	Assert.assertEquals(SequentialIndividualCompleter.class, completer.getClass());
}
 
Example #14
Source File: HealthServiceIntegrationTest.java    From cassandra-sidecar with Apache License 2.0 5 votes vote down vote up
@BeforeEach
void setUp() throws InterruptedException
{
    AtomicBoolean failedToListen = new AtomicBoolean(false);

    do
    {
        injector = Guice.createInjector(Modules.override(new MainModule())
                                               .with(new IntegrationTestModule(1, sessions)));
        vertx = injector.getInstance(Vertx.class);
        HttpServer httpServer = injector.getInstance(HttpServer.class);
        Configuration config = injector.getInstance(Configuration.class);
        port = config.getPort();

        CountDownLatch waitLatch = new CountDownLatch(1);
        httpServer.listen(port, res ->
        {
            if (res.succeeded())
            {
                logger.info("Succeeded to listen on port " + port);
            }
            else
            {
                logger.error("Failed to listen on port " + port + " " + res.cause());
                failedToListen.set(true);
            }
            waitLatch.countDown();
        });

        if (waitLatch.await(60, TimeUnit.SECONDS))
            logger.info("Listen complete before timeout.");
        else
            logger.error("Listen complete timed out.");

        if (failedToListen.get())
            closeClusters();
    } while(failedToListen.get());
}
 
Example #15
Source File: LocalPersistenceModuleTest.java    From hivemq-community-edition with Apache License 2.0 5 votes vote down vote up
private Injector createInjector(final LocalPersistenceModule localPersistenceModule) {
    return Guice.createInjector(
            localPersistenceModule,
            new LazySingletonModule(),
            new ThrottlingModule(),
            new MQTTServiceModule(),
            new AbstractModule() {
                @Override
                protected void configure() {
                    bind(FullConfigurationService.class).toInstance(configurationService);
                    bind(TopicMatcher.class).toInstance(topicMatcher);
                    bind(SystemInformation.class).toInstance(systemInformation);
                    bind(ListeningExecutorService.class).annotatedWith(Persistence.class)
                            .toInstance(listeningExecutorService);
                    bind(ListeningScheduledExecutorService.class).annotatedWith(Persistence.class)
                            .toInstance(listeningScheduledExecutorService);
                    bind(ListeningScheduledExecutorService.class).annotatedWith(PayloadPersistence.class)
                            .toInstance(listeningScheduledExecutorService);
                    bind(MessageIDPools.class).toInstance(messageIDProducers);
                    bind(MetricsHolder.class).toInstance(metricsHolder);
                    bind(MetricRegistry.class).toInstance(new MetricRegistry());
                    bind(SingleWriterService.class).toInstance(singleWriterService);
                    bind(EventLog.class).toInstance(eventLog);
                    bind(MessageDroppedService.class).toInstance(messageDroppedService);
                    bind(RestrictionsConfigurationService.class).toInstance(new RestrictionsConfigurationServiceImpl());
                    bind(MqttConfigurationService.class).toInstance(mqttConfigurationService);
                }
            });
}
 
Example #16
Source File: PersistenceModuleTest.java    From hivemq-community-edition with Apache License 2.0 5 votes vote down vote up
@Test
public void test_shutdown_singleton() throws ClassNotFoundException {


    final Injector injector = Guice.createInjector(new PersistenceModule(
            persistenceInjector,
            new TestConfigurationBootstrap().getPersistenceConfigurationService()), new AbstractModule() {
        @Override
        protected void configure() {
            bind(SystemInformation.class).toInstance(Mockito.mock(SystemInformation.class));
            bind(MessageDroppedService.class).toInstance(Mockito.mock(MessageDroppedService.class));
            bind(InternalPublishService.class).toInstance(Mockito.mock(InternalPublishService.class));
            bind(PublishPollService.class).toInstance(Mockito.mock(PublishPollService.class));
            bindScope(LazySingleton.class, LazySingletonScope.get());
            bind(MqttConfigurationService.class).toInstance(mock(MqttConfigurationService.class));
            bind(MetricsHolder.class).toInstance(mock(MetricsHolder.class));
            bind(FullConfigurationService.class).toInstance(Mockito.mock(FullConfigurationService.class));
            bind(TopicMatcher.class).toInstance(Mockito.mock(TopicMatcher.class));
            bind(MessageIDPools.class).toInstance(Mockito.mock(MessageIDPools.class));
            bind(MetricRegistry.class).toInstance(new MetricRegistry());
            bind(SingleWriterService.class).toInstance(Mockito.mock(SingleWriterService.class));
            bind(EventLog.class).toInstance(Mockito.mock(EventLog.class));
            bind(RestrictionsConfigurationService.class).toInstance(new RestrictionsConfigurationServiceImpl());
        }
    });

    final PersistenceShutdownHookInstaller instance1 = injector.getInstance(PersistenceShutdownHookInstaller.class);
    final PersistenceShutdownHookInstaller instance2 = injector.getInstance(PersistenceShutdownHookInstaller.class);

    assertSame(instance1, instance2);
}
 
Example #17
Source File: SingletonModuleTest.java    From hivemq-community-edition with Apache License 2.0 5 votes vote down vote up
@Test
public void test_singleton_provider_module_configured_executed_once() throws Exception {
    final SingletonProviderModuleWithConfiguredMethod module1 = new SingletonProviderModuleWithConfiguredMethod();
    final SingletonProviderModuleWithConfiguredMethod module2 = new SingletonProviderModuleWithConfiguredMethod();

    final Injector injector = Guice.createInjector(module1, module2);
    injector.getInstance(String.class);
    injector.getInstance(String.class);

    assertTrue(module1.accessed ^ module2.accessed);
    assertTrue(module1.provided ^ module2.provided);
}
 
Example #18
Source File: SequentialIndividualCompleterTest.java    From opt4j with MIT License 5 votes vote down vote up
@Test(expected = IllegalStateException.class)
public void decodePhenotyped() throws TerminationException {
	Injector injector = Guice.createInjector(new MockProblemModule());
	IndividualFactory factory = injector.getInstance(IndividualFactory.class);
	Individual i1 = factory.create();

	SequentialIndividualCompleter completer = injector.getInstance(SequentialIndividualCompleter.class);

	completer.decode(i1);
	completer.decode(i1);
}
 
Example #19
Source File: Main.java    From java-11-examples with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
    ExecutorService executor = Executors.newSingleThreadExecutor();

    ExampleModule exampleModule = new ExampleModule(executor);
    Injector injector = Guice.createInjector(exampleModule, new AppModule());

    messageClientService = injector.getInstance(MessageClientServiceImpl.class);
}
 
Example #20
Source File: Application.java    From layer-architecture with MIT License 5 votes vote down vote up
public static void main(String[] args) {
    Injector injector = Guice.createInjector(new BlogModule());
    BlogRepository repository = injector.getInstance(BlogRepository.class);

    Blog blog = new Blog("title", "content");
    repository.save(blog);

    String id = blog.getId();
    repository.findById(id).ifPresent(
            blog1 -> {
                System.out.println(blog1.getId());
            }
    );
}
 
Example #21
Source File: DyneinExampleApplication.java    From dynein with Apache License 2.0 5 votes vote down vote up
@Override
public void run(ExampleConfiguration configuration, Environment environment) {
  Injector injector =
      Guice.createInjector(
          new SchedulerModule(configuration.getScheduler()), new ExampleModule(configuration));
  final ExampleResource resource = injector.getInstance(ExampleResource.class);
  environment.jersey().register(resource);
  // worker that executes the jobs
  environment.lifecycle().manage(injector.getInstance(ManagedWorker.class));
  // worker that fetches jobs from inbound queue
  environment.lifecycle().manage(injector.getInstance(ManagedInboundJobQueueConsumer.class));
  // worker that executes schedules from dynamodb
  environment.lifecycle().manage(injector.getInstance(WorkerManager.class));
}
 
Example #22
Source File: AbstractArchiveTest.java    From opt4j with MIT License 5 votes vote down vote up
/**
 * Tests {@link AbstractArchive#removeArchiveDominated(List)} with a
 * candidate which has the same objectives as an individual in the archive.
 * To avoid unnecessary archive updates, the candidate is expected to be
 * discarded here.
 */
@Test
public void removeArchiveDominatedTest3() {
	Injector injector = Guice.createInjector(new MockProblemModule());
	IndividualFactory factory = injector.getInstance(IndividualFactory.class);

	Objective o0 = new Objective("o0");
	Objective o1 = new Objective("o1");

	Individual iArchived0 = factory.create();
	Objectives objectivesA0 = new Objectives();
	objectivesA0.add(o0, 0);
	objectivesA0.add(o1, 0);
	iArchived0.setObjectives(objectivesA0);

	TestArchive archive = new TestArchive();
	archive.add(iArchived0);

	Individual i0 = factory.create();
	Objectives objectives0 = new Objectives();
	objectives0.add(o0, 0);
	objectives0.add(o1, 0);
	i0.setObjectives(objectives0);

	List<Individual> list = new ArrayList<>();
	list.add(i0);
	archive.removeArchiveDominated(list);

	Assert.assertEquals(0, list.size());
	Assert.assertFalse(list.contains(i0));
	Assert.assertEquals(1, archive.size());
	Assert.assertTrue(archive.contains(iArchived0));
}
 
Example #23
Source File: ShutdownHooksTest.java    From hivemq-community-edition with Apache License 2.0 5 votes vote down vote up
@Test
public void test_singleton() throws Exception {
    final Injector injector = Guice.createInjector(new AbstractModule() {
        @Override
        protected void configure() {
            bind(SystemInformation.class).toInstance(new SystemInformationImpl());
        }
    });

    final ShutdownHooks instance = injector.getInstance(ShutdownHooks.class);
    final ShutdownHooks instance2 = injector.getInstance(ShutdownHooks.class);
    assertSame(instance, instance2);

}
 
Example #24
Source File: MQTTHandlerModuleTest.java    From hivemq-community-edition with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    injector = Guice.createInjector(new AbstractModule() {
        @Override
        protected void configure() {
            final Injector persistenceInjector = mock(Injector.class);
            when(persistenceInjector.getInstance(MessageDroppedService.class)).thenReturn(mock(MessageDroppedServiceImpl.class));
            install(new MQTTHandlerModule(persistenceInjector));
        }
    });
}
 
Example #25
Source File: RunKernelControlCenter.java    From openAGV with Apache License 2.0 5 votes vote down vote up
/**
 * The kernel control center client's main entry point.
 *
 * @param args the command line arguments
 */
@SuppressWarnings("deprecation")
public static void main(final String[] args) {
  System.setSecurityManager(new SecurityManager());
  Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionLogger(false));
  System.setProperty(org.opentcs.util.configuration.Configuration.PROPKEY_IMPL_CLASS,
                     org.opentcs.util.configuration.XMLConfiguration.class.getName());

  Environment.logSystemInfo();

  Injector injector = Guice.createInjector(customConfigurationModule());
  injector.getInstance(KernelControlCenterApplication.class).initialize();
}
 
Example #26
Source File: RunKernel.java    From openAGV with Apache License 2.0 5 votes vote down vote up
/**
 * Initializes the system and starts the openTCS kernel including modules.
 *
 * @param args The command line arguments.
 * @throws Exception If there was a problem starting the kernel.
 */
@SuppressWarnings("deprecation")
public static void main(String[] args)
    throws Exception {
  System.setSecurityManager(new SecurityManager());
  Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionLogger(false));
  System.setProperty(org.opentcs.util.configuration.Configuration.PROPKEY_IMPL_CLASS,
                     org.opentcs.util.configuration.XMLConfiguration.class.getName());

  Environment.logSystemInfo();

  LOG.debug("Setting up openTCS kernel {}...", Environment.getBaselineVersion());
  Injector injector = Guice.createInjector(customConfigurationModule());
  injector.getInstance(KernelStarter.class).startKernel();
}
 
Example #27
Source File: RunPlantOverview.java    From openAGV with Apache License 2.0 5 votes vote down vote up
/**
 * The plant overview client's main entry point.
 *
 * @param args the command line arguments
 */
@SuppressWarnings("deprecation")
public static void main(final String[] args) {
  System.setSecurityManager(new SecurityManager());
  Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionLogger(false));
  System.setProperty(org.opentcs.util.configuration.Configuration.PROPKEY_IMPL_CLASS,
                     org.opentcs.util.configuration.XMLConfiguration.class.getName());

  Environment.logSystemInfo();

  Injector injector = Guice.createInjector(customConfigurationModule());
  injector.getInstance(PlantOverviewStarter.class).startPlantOverview();
}
 
Example #28
Source File: ThrottlingModuleTest.java    From hivemq-community-edition with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    injector = Guice.createInjector(new AbstractModule() {
        @Override
        protected void configure() {
            install(new ThrottlingModule());
            bind(SystemInformation.class).toInstance(mock(SystemInformation.class));
            bind(RestrictionsConfigurationService.class).toInstance(mock(RestrictionsConfigurationService.class));
            bindScope(LazySingleton.class, LazySingletonScope.get());
        }
    });
}
 
Example #29
Source File: Hismo2JSONStandaloneSetup.java    From Getaviz with Apache License 2.0 5 votes vote down vote up
public Injector createInjector() {
	return Guice.createInjector(new HismoRuntimeModule() {

		@Override
		public Class<? extends IGenerator2> bindIGenerator2() {
			return Hismo2JSON.class;
		}
	});
}
 
Example #30
Source File: SingletonModuleTest.java    From hivemq-community-edition with Apache License 2.0 5 votes vote down vote up
@Test
public void test_standard_guice_module_executed_twice() throws Exception {
    final StandardModuleWithConfiguredMethod module1 = new StandardModuleWithConfiguredMethod();
    final StandardModuleWithConfiguredMethod module2 = new StandardModuleWithConfiguredMethod();

    Guice.createInjector(module1, module2);

    assertTrue(module1.accessed && module2.accessed);
}