This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
You mean you have a class that does something like this?
If that's the case, all you need to do is grab the MockContextFactory class from the MockEJB project and fake the JNDI tree. There's an example of this in the freely available online bonus chapter of my book.
I am actually in the middle of the book and i might need to start from the bonus chapter (i am working with JPA and Ejb3 with JBoss).
Do you have there a solution for injection.
I mean when you have in your ejb a resource injection like @Ejb and etc I dont want to insert a IOVC framework for testing only.
Joined: Jan 23, 2002
Originally posted by avihai marchiano: I mean when you have in your ejb a resource injection like @Ejb and etc I dont want to insert a IOVC framework for testing only.
Well, you don't need any frameworks/libraries if you make your @EJB/@Resource annotated fields visible (protected, package private, public) to the test code. If you don't want to do that, you can use Java's reflection API to forcibly assign a mock to the annotated field. That's a bit clunky, though, so it would probably be easier to use a library that does the nasty reflection stuff for you. If this is the way to go, I'd recommend BeanInject.
subject: Dependency in the container due to context.lookup