I've been trying to write a Junittest class for an ejb that delegates calls to various business services.
I've tried bypassing the Ejb and calling the services directly, but either way the same error appears (as the Business Services ultimately call the database, therefor the contect needs to be set up).
The error could just be a classpath conflict (com/ibm/ejs/jts/jts/Current), but I cannot find the appropriate class or jar anywhere. I'm Using Websphere 5.1.
The error is
How else can I test this - how would I 'mock' a call to the database without altering the business code?
Joined: Jan 23, 2002
The stack trace you posted implies that the code you're invoking eventually does a JNDI lookup to find a DataSource. You can use MockEJB for setting up a fake, local JNDI tree and bind whatever objects you want to it, therefore making your JNDI lookup for "jdbc/ds1" obtain exactly what you want instead of the real thing.
In your case, you might bind a mock object that you've configured with tools like EasyMock or jMock, or alternatively an actual DataSource object that connects to a local, embedded database such as HSQLDB.