Announcement Announcement Module
Collapse
No announcement yet.
Controller's onSubmit method unit testing with EasyMock Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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 .

  • #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

    Comment

    Working...
    X