Best practice for @EJB injection in junit test (out-of-container) ?

Advertisement
Hi all,
I'd like to run a JUnit test for a Stateless bean A which has another bean B injected via the @EJB annotation. Both beans are pure EJB 3 POJOs.
The JUnit test should run out-of-container and is not meant to be an EJB client, either.
What is the easiest/suggested way of getting this injection happening without explicitely having to instantiate the bean B in my test setup ?
Advertisement

Replay

you can deal with EntityBeans without having the Container managed senario , you can obtain instance of EntityManager using the "EntityManagerFactory" and providing the "persistence.xml" file and provide the "provider" (toplink,hibernate ,...), then you can use entities as plain un managed classes