-
Notifications
You must be signed in to change notification settings - Fork 180
JUnit Testing
elandau edited this page May 20, 2014
·
1 revision
Governator provides an easy to use JUnit @Rule that simplifies testing. The rule can be easily configured using the {@link LifecycleInjectorBuilder} or by grouping sets of operations with a {@link LifecycleInjectorBuilderSuite}
public class MyUnitTest {
@Rule
public LifecycleTester tester = new LifecycleTester(new FooTestSuite());
@Test
public void test() {
// Test specific setup
tester.builder().
withAdditionalModule(new BarModule());
// Create the injector and start LifecycleManager
tester.start();
// ... Your test code goes here
} // On termination the LifecycleTester will shutdown LifecycleManager
}
- Home
- Getting Started
- Bootstrapping
- Lifecycle Management
- Auto Binding
- Module-Dependencies
- Warm Up
- Configuration Mapping
- Field Validation
- Lazy Singleton
- Concurrent Singleton
- Generic Binding Annotations
- LifecycleListener
- Governator Phases
- Grapher Integration
- JUnit Testing
- FAQ
- Best Practices
- Spring, PicoContainer, Etc.
- Javadoc
- End-to-End Examples