-
Jun 21st, 2012, 07:36 AM
#1
MockHttpServletRequest
I'm trying to create a MockHttpServletRequest using addParameter(String,String) or setParameter(String,String). However, both these methods create a String[] instead of a String value. When I execute the method under test, it fails because it is calling request.getParameter(String) which is looking for a string parameter and not a string array. I looked at the source code for the MockHttpServletRequest and both the addParameter and setParameter methods convert the string value passed in into a string array and calls the overloaded addParameter(String,String[]) or setParameter(String,String[]). Is there a way to test this legacy code using a mock servlet request without changing the code. The objective is to get the method under test and then to refactor as needed. Thank you for any help you may be able to provide.
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