You're using the following constructor: public MockHttpServletRequest(String method, String requestURI)
but a requestURI does not include the queryString
(see http://java.sun.com/j2ee/1.4/docs/ap...etRequestURI())
It doesn't answer your question and it's probably just a matter of taste, but I much prefer:
Code:
request = new MockHttpServletRequest();
request.addParameter ("userId","2");
Because it clearly documents the needs of your controller (eg. controller probably doesn't need to know the method, nor the serverPort).
regards,
Maarten