Class GuiceTestCase

java.lang.Object
org.forgerock.guice.core.GuiceTestCase
All Implemented Interfaces:
com.google.inject.Module

public abstract class GuiceTestCase extends Object implements com.google.inject.Module
A test case that allows registration of guice modules for the life of each test method being run.
Since:
1.1.0
  • Constructor Details

  • Method Details

    • setupGuiceModules

      @BeforeMethod public void setupGuiceModules() throws Exception
      Binds this object and any modules declared from the GuiceModules annotation in an injector, and registers it in the InjectorHolder.
      Throws:
      Exception - Thrown on failure of any type.
    • teardownGuiceModules

      @AfterMethod public void teardownGuiceModules() throws Exception
      After the test method has run, the injector is reset to its old value.
      Throws:
      Exception - Thrown on failure of any type.
    • configure

      public void configure(com.google.inject.Binder binder)
      A default, empty implementation is provided as the test may not have any of its own objects to bind.
      Specified by:
      configure in interface com.google.inject.Module
      Parameters:
      binder - The Guice binder.
    • configureOverrideBindings

      protected void configureOverrideBindings(com.google.inject.Binder binder)
      Bindings specified on this binder will be used to override bindings specified in configure(Binder) and via the GuiceModules annotation.
      Parameters:
      binder - The Guice binder.