Spring: I wish to create a junit test for a web application - WebApplicationContext needed

Posted by Yaneeve on Stack Overflow See other posts from Stack Overflow or by Yaneeve
Published on 2010-04-19T07:24:53Z Indexed on 2010/04/19 7:33 UTC
Read the original article Hit count: 372

Hi all,

I am writing a junit test in order to (surprisingly) test a part of my app as a standalone.

Thing is I execute the following line in a constructor being invoked in the unit test:

WebApplicationContext webApplicationContext = ContextLoader.getCurrentWebApplicationContext();

How would I go about to set up a web context when running a simple unit test?

Thanks

© Stack Overflow or respective owner

Related posts about spring

Related posts about web-development