title: Spring MockMVC inject mockHttpServletRequest when not in method signature
body: <p>Given I have inherited some Spring MVC controller code with signature</p>
  
  <pre><code>@RequestMapping(value = "/upload", method = RequestMethod.POST)
  public ModelAndView upload(HttpServletRequest request, HttpServletResponse response) {
  
    String remoteAddress = request.getRemotedAddr();
    auditService.logAddress(remoteAddress);
  
    // do work...
  
    return mav;
  }
  </code></pre>
  
  <p>and I have a Spring MockMvc test that performs the test</p>
  
  <pre><code>public void someTest() {
      mockMvc().perform(fileUpload("/upload").file(FileFactory.stringContent("myFile")));
  
      // do work...
      verify(auditService.logAddress("123456"));
  }
  </code></pre>
  
  <p>I need to set the remote address to "12345" on the HttpServletRequest object that is passed into my upload controller method, so I can verify the call to mock <strong>auditService</strong> in the test.</p>
  
  <p>I can create a <strong>MockHttpServletRequest</strong> object and call the <strong>setRemoteAddr()</strong> method, but how to pass this mock request object to the mockMvc() method call?</p>