title: Testing MultipartFile with WebtestClient
body: <p>I am writing unit tests for my controller class. I am using spring webflux. Hence I am writing tests with <code>WebTestClient</code>. Here is my controller method  </p>
  
  <pre><code>@PutMapping("/updatedocument/{documentType}")
  public ResponseEntity&lt;String&gt; updateDocument(@PathVariable String documentType,
                                               @RequestParam("file") MultipartFile file) {
       ...................
  }
  </code></pre>
  
  <p>This code is working when I call from Postman or any rest client. I am having difficulty in writing unit test. I am getting </p>
  
  <blockquote>
    <p>"Required MultipartFile parameter 'file' is not present"</p>
  </blockquote>
  
  <p>Error . Here is my test method.</p>
  
  <pre><code>@Test
  void updateDocument() throws IOException {
  
      .............
      MultipartBodyBuilder multipartBodyBuilder = new MultipartBodyBuilder();
      multipartBodyBuilder.part("file", new ClassPathResource("somefile"))
              .contentType(MediaType.MULTIPART_FORM_DATA)
  
      webTestClient.put()
              .uri("/customer/updatedocument/ID")
              .body(BodyInserters.fromMultipartData(multipartBodyBuilder.build()))
              .exchange()
              .expectStatus().isOk();
  }
  </code></pre>
  
  <p>Any suggestion is much appreciated. Please NOTE. I am using <code>WebTestClient</code> and not <code>MovkMvc</code></p>