Challenge

You want to write a couple of Integration tests with JUnit and want to use Weld for the CDI part, but don’t know how…

Solution

Weld dependency

Create a couple of helper classes:

WeldJUnit4Runner

Initialize bean context for test by creating in the src/test/resources/META-INF folder the beans.xml file