I'm using mockejb framework to mock entity beans in memory, I make a lookup, mockejb brings me a proxy for the real entity. That's working.
But I needed to get a Session Bean from the container JNDI to "understand" that. I mean, when the Session Bean make a lookup to the Entity Bean, I want it to receive the bean I've mocked, not a bean from the database.
I can't mock this Session Bean because inside the method I'm trying to mock, there's a lookup to the entity bean so, I need this method to execute normally but to receive the mocked bean when lookup.
[UPDATE] Informations about my development environment: I'm using IBM RSA 7.5, IBM Websphere 6.1, I have a Web Test Project that runs in-container with Cactus, the last libs on my classpath are:
- cactus-1.7.2.jar
- cglib-nodep-2.1_3.jar
- commons-httpclient-2.0.2.jar
- commons-logging-1.0.4.jar
- powermock-easymock-1.3.9-full.jar
- junit-3.8.1.jar
- mockejb.jar
Obs.: I've already changed to the latest powermock version with jUnit4, and tried to use EasyMock 3.0 only, and also tried EasyMock 2.x with its class extensions. None of these worked. What really intrigues me is this DefaultInstantiator configuration mentioned on EasyMock docs: http://easymock.org/EasyMock2_4_ClassExtension_Documentation.html. I wondered if that's my case (not supported JVM) and I couldn't make it work.
Thanks for helping.