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>2.2.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.
Weld SE 1.0.1 users
If you are using Weld SE as a compile time dependency then you must specify version 1.1.0 or above as CDI-unit is not compatible with Weld SE 1.0.1