title: Using Spring MVC Test to unit test multipart POST request
body: <p>I have the following request handler for saving autos. I have verified that this works when I use e.g. cURL. Now I want to unit test the method with Spring MVC Test. I have tried to use the fileUploader, but I am not managing to get it working. Nor do I manage to add the JSON part. </p>
  
  <p>How would I unit test this method with Spring MVC Test? I am not able to find any examples on this.</p>
  
  <pre><code>@RequestMapping(value = "autos", method = RequestMethod.POST)
  public ResponseEntity saveAuto(
      @RequestPart(value = "data") autoResource,
      @RequestParam(value = "files[]", required = false) List&lt;MultipartFile&gt; files) {
      // ...
  }
  </code></pre>
  
  <p>I want to uplod a JSON representation for my auto + one or more files.</p>
  
  <p><strong>I will add 100 in bounty to the correct answer!</strong></p>