title: Spring microservice end-to-end testing
body: <p>I'd like to write a end to end test for a pipeline, built with spring boot. </p>
  
  <p>Consider two microservices A, B where B consumes output from A and produces a RESTful API. They are connected using rabbitmq and rely on an external database.</p>
  
  <p><a href="https://i.stack.imgur.com/moij3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/moij3.png" alt="System scheme"></a></p>
  
  <p>I would like to achieve something like:</p>
  
  <ol>
  <li>Create a new project that includes both microservices</li>
  <li>Create a test configuration that configures JPA provider to be an in-memory database</li>
  <li>Inject custom MQ into A, B to connect them (rabbitmq is not tightly coupled)</li>
  <li>Write tests</li>
  </ol>
  
  <p>Essentially replacing the white parts with mocks and testing the coloured parts.</p>
  
  <p>Does this make sense? Test coverage of A and B is not complete and such a test would guarantee that the contract between A and B holds. Are there better ways?</p>