title: How to test rest endpoint which accepts java object which contain multipart formadata
body: <p>I'm stuck with unit testing of rest controller which has post method
  which is accepting a RequestBody of java object which contains the multipart file.</p>
  <p>various options I search for shows how to send a single file along with request or making them as part.</p>
  <p>is there a way to test the whole object as single entity.</p>
  <p><strong>Model class</strong></p>
  <pre><code>@Data
  public class Person{
    private String name;
    private String age;
    private List&lt;MultipartFile&gt; images;
  }
  </code></pre>
  <p>and the rest controller to handle the request is</p>
  <p><strong>Rest Controller</strong></p>
  <pre><code>@RestController
  @RequestMapping(&quot;/v1)
  public class PersonRestController{
  
    @Autowired
    private IPersonService personService;
  
    @PostMapping(&quot;/save&quot;)
    public ResponseEntity&lt;String&gt; savePerson(@ModelAttribute Person person){
      String name = personService.savePerson(person);
      return new ResponseEntity&lt;String&gt;(name,HttpStatus.CREATED);
    }
  
  }
  </code></pre>
  <p>will be really helpful if anyone could help.</p>