public MockMvcRequestSpecBuilder setBody(Object object, ObjectMapperType mapperType) {
        spec.body(object, mapperType);
        return this;
    }
public MockMvcRequestSpecBuilder setBody(Object object, ObjectMapperType mapperType) {
        spec.body(object, mapperType);
        return this;
    }
public MockMvcRequestSpecBuilder setBody ( Object object , ObjectMapperType mapperType ) { spec . body ( object , mapperType ) ; return this ; }
Specify an Object request content that will automatically be serialized to JSON or XML and sent with the request using a specific object mapper type.
This works for the POST, PATCH and PUT methods only. Trying to do this for the other http methods will cause an exception to be thrown.
<p>
Example of use:
<pre>
Message message = new Message();
message.setMessage("My beautiful message");

given().
body(message, ObjectMapper.GSON).
expect().
content(equalTo("Response to a beautiful message")).
when().
post("/beautiful-message");
</pre>
</p>
Note that {@link #setBody(Object, ObjectMapperType)}
are the same except for the syntactic difference.
</p>

@param object     The object to serialize and send with the request
@param mapperType The object mapper type to be used
@return The request specification
Specify an Object request content that will automatically be serialized to JSON or XML and sent with the request using a specific object mapper type . This works for the POST PATCH and PUT methods only . Trying to do this for the other http methods will cause an exception to be thrown . <p > Example of use : <pre > Message message = new Message () ; message . setMessage ( My beautiful message ) ;