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 TypeMethodDescriptionvoid
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.protected void
configureOverrideBindings
(com.google.inject.Binder binder) Bindings specified on this binder will be used to override bindings specified inconfigure(Binder)
and via theGuiceModules
annotation.void
Binds this object and any modules declared from the GuiceModules annotation in an injector, and registers it in the InjectorHolder.void
After 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:
configure
in 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 theGuiceModules
annotation.- Parameters:
binder
- The Guice binder.
-