views:

304

answers:

2

How to make unit test of servlets which uses jndi for lookup of datasource (JDBC) ?

+1  A: 

Setup the JNDI context in your @Before (or @BeforeClass) methods, by manually creating the datasource.

(The answer is only guiding, but I can't provide anything concrete, since you haven't provided anything concrete)

Bozho
A: 

If the problem is that you need JNDI then there is a simple standalone implementation which Can be used in applications and Unit tests scenarios.

Thorbjørn Ravn Andersen