I have written a DAO class which handles all CRUD operations and want to unit test it. The database is already loaded with data. I tried to use dbunit but my application fails to create a connection with the DB as I am using JNDI service for creating a connection at server startup whereas my dbunit test looks for the connection at compile time. How can I overcome this issue? Do I need to do major refactoring? Any useful article on the web replicating a this scenario would also help.
posted 5 years ago
Please advise as how can I unit test this kind of stuff ?