Or an even more EasyMock like approach:
final JavaArchive ejb = ShrinkWrap.create(JavaArchive.class, "test.jar")
This would add MyReferenced2ndService class and generated mock implementation, additionally. So, this might be even extended, if you like: addStrictMock, addSimpleMock and so on...
Sorry, wiki formatting does not occur like expected.
Have been playing with the thought in relation to some MC Bean Service mocking.
But can EasyMock generate a complete Mock Class?
I was looking into Mockito at the time, and as far as i found it could only generate a Serialized object of the Mock it self. To be able to get for instance the EJB Container to load it as a bean, we need to have the Mock not as a Object Stream but as a Class. (think javassist, not java Proxy)
Hm, ok I see. Yes, EasyMock uses java proxy for generating mock objects.
I'll try to find help finding a mock framework that suits for this usecase.
MockEJB (http://www.mockejb.org) seems to behave like expected but is outdated and does not support EJB3.