Hi,
I have mocked both container specific stuff and collaboration dependecies for my servlet.
Must test executes fine but spits out the following message:
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file
I have mocked class:
final InitialContext ctx = context.mock(InitialContext.class);
And setup the expectations:
context.checking(new Expectations(){{
allowing(ctx).lookup("DomainStuff"); will (returnValue(ds));
}});
It seems like my InitialContext class is missing something:
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:284)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
What can I do to avoid this exception? Is there any way forward using Jmock 2?
cheers,
//mike