Package org.forgerock.guice.core
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 Summary
Constructors Constructor Description GuiceTestCase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconfigure(com.google.inject.Binder binder)A default, empty implementation is provided as the test may not have any of its own objects to bind.protected voidconfigureOverrideBindings(com.google.inject.Binder binder)Bindings specified on this binder will be used to override bindings specified inconfigure(Binder)and via theGuiceModulesannotation.voidsetupGuiceModules()Binds this object and any modules declared from the GuiceModules annotation in an injector, and registers it in the InjectorHolder.voidteardownGuiceModules()After the test method has run, the injector is reset to its old value.
-
-
-
Method Detail
-
setupGuiceModules
@BeforeMethod public void setupGuiceModules() throws ExceptionBinds 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 ExceptionAfter 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:
configurein interfacecom.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 inconfigure(Binder)and via theGuiceModulesannotation.- Parameters:
binder- The Guice binder.
-
-