Package org.forgerock.guice.core
Class GuiceTestCase
java.lang.Object
org.forgerock.guice.core.GuiceTestCase
- All Implemented Interfaces:
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 -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigure(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.voidBinds this object and any modules declared from the GuiceModules annotation in an injector, and registers it in the InjectorHolder.voidAfter the test method has run, the injector is reset to its old value.
-
Constructor Details
-
GuiceTestCase
public GuiceTestCase()
-
-
Method Details
-
setupGuiceModules
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
After the test method has run, the injector is reset to its old value.- Throws:
Exception- Thrown on failure of any type.
-
configure
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
Bindings specified on this binder will be used to override bindings specified inconfigure(Binder)and via theGuiceModulesannotation.- Parameters:
binder- The Guice binder.
-