On 27/03/2010 12:16 AM, Andrei Ionescu wrote:

For the beginning, my application is using a ServletContextListener to
do some stuff (like init embedded database, prepare some files, etc.) ,
but I don't seem to get it how to unit test if that listener is doing
it's job correctly :(.
How do I simulate with click-mock that what a servlet container would
do? to see if the ServletContextListener works as it should?


The mock support does not provide a full runtime environment of the servlet implementation e.g. filters and listeners aren't implemented. Neither is the web.xml parsed or interpreted.

It shouldn't be too hard to add mock listeners. However its worth thinking of when to mock and when to switch to something more realistic like automated Selenium or WebDriver tests against the running application.

kind regards

bob


Reply via email to