I’m using IBM RAD 7 (aka Eclipse 3.4) and WebSphere 7.
I have an EJB project that contains an @Stateless EntityService and an @Stateless EntityDAO and so on.
I have an Web project that contains a JAX-RS restful web service that looks up the EntityService with this JNDI URL:
ejblocal:entityEAR/entityEJB.jar/EntityService@com.test.EntityServiceLocal
That all works great.
My question is, what would be the “correct” way to write JUnit tests to test the EntityService and EntityDAO classes?
Since the system needs to be running in the WebLogic server to function, I thought I would get the app running, then launch the JUnit test which does a look up of the same JNDI that the web service is using, but I get an error:
Naming Manager ... getURLContext cannot find the factory for this scheme: ejbLocal
Any suggestions are useful, how should I approach writing JUnit tests?
At the end of the day, I implemented a @Remote remote interface for the Service classes I wanted to test, and did a remote JNDI lookup to the service bean.
More details here:
how to write a JUnit test that can see my EJB service?