title: How to unit test file uploads with MockHttpServletRequest?
body: <p>I've a Spring (3.0) Controller with a method which has <code>HttpServletRequest</code> as one of the parameters, since it's handling (multiple) file uploads.</p>
  
  <pre><code>@RequestMapping(value = "/classified/{idClassified}/dealer/{idPerson}/upload",
      method = RequestMethod.POST)
  @ResponseBody
  public final String uploadClassifiedPicture(
      @PathVariable int idClassified,
      @PathVariable int idPerson, 
      @RequestParam String token, 
      HttpServletRequest request);
  </code></pre>
  
  <p>How to Unit Test it? I know I can create a <code>MockHttpServletRequest</code>, but I don't know how to pass one or more files to it.</p>
  
  <pre><code>MockHttpServletRequest request = new MockHttpServletRequest("POST", 
       "/classified/38001/dealer/54/upload?token=dfak241adf");
  </code></pre>