-
Apr 17th, 2008, 11:18 PM
#1
Controller's onSubmit method unit testing with EasyMock
Hi spring guys,
I want to write unit test case for my spring project.
can anybody tell me how to write unit test for onSubmit() method of controller that is returning a list of objects for success view using EasyMock?
Please help me .
-
Apr 18th, 2008, 01:28 AM
#2
You can only call the handleRequest method on a Controller.
So you basically need to
1) Create a HttpServletRequest and HttpServletResponse (available in spring-test.jar)
2) setup the properties and correct method (POST or GET)
3) Mock the services/dao for you controller
4) setup your controller
5) call the method
6) interpret the returned ModelAndView
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules