CDI-Unit is a JUnit4 test runner that enables unit testing Java CDI applications.
- Fast - CDI-Unit only starts up the bare minimum when running your unit tests. Got a large project with thousands of classes on the classpath? No problem.
- Easy – All configuration is performed in the unit test class using annotations. No external files, no XML.
- Contained – Your tests are run outside of a web container. No risk of resource conflicts or environment specific behaviour.
CDI-Unit is distributed through maven, so you just need to add the dependency to your pom:
<dependency> <groupId>org.jglue.cdi-unit</groupId> <artifactId>cdi-unit</artifactId> <version>3.0.1</version> <scope>test</scope> </dependency>
Note that CDI-Unit is now distributed through maven central. Users of older versions should upgrade and remove references to the old repository from their poms.
CDI-Unit is compatible with Weld 1.1.4 and above.