In many cases when you are testing java software that you develop, you must do some unit testing using famous testing framework such as JUnit or TestNG. This testing process allowed you to do a great testing cases and automatic all the process but there is some problems when your program includes non-standard Java SE classes. This is the cases when you use EJB.

The EJB artifacts are Java components that in the modern times (forget about the 2.1 version!!) support dependency injection. So, when the EJB container is in execution, it has the goal to instance the EJB and all its dependencies and give to us an “completed object” when all the dependencies set, but you don’t have any EJB container when you are running your JUnit test, so what you can do? Ok, there is a free software library which can help us with that. The name of the project is the following: Ejb3Unit, and you can get it by these URL: http://ejb3unit.sourceforge.net/.

(more…)