Wednesday, August 10, 2005 08:36 AM
You're getting lookup problems because JUnit is a J2SE framework, while EJBs are J2EE and therefore require a container (e.g. an application server such as JBoss).
The solution to this problem is not actually test the deployment of your EJBs (which after all is a container issue, and something that probably isn't of great concern to you), and test the actual internal behaviour of the EJBs. When you think about it, this doesn't actually require J2EE, so you can "mock" your EJBs to test them.
I recommend http://mockejb.sourceforge.net as an excellent starting point. You only have to add a couple of lines to your TestCase#setUp to establish a mock JNDI environment and deploy your EJBs, and then you're away!