title: MockRestServiceServer: how to mock a POST call with a body?
body: <p>I am trying to mock a POST method with <code>MockRestServiceServer</code> in the following way:</p>
  
  <pre><code>MockRestServiceServer server = bindTo(restTemplate).build();
  server.expect(requestTo("/my-api"))
          .andExpect(method(POST))
          .andRespond(withSuccess(expectedResponce, APPLICATION_JSON));
  </code></pre>
  
  <p><strong>Problem:</strong> How do I verify a request body in this setup?</p>
  
  <p>I browsed through <a href="https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/test/web/client/MockRestServiceServer.html" rel="noreferrer">the documentation</a> and some examples and still can't figure out how it can be done.</p>