RestTestClient provides similar features as WebTestClient for imperative scenarios using RestClient. We should update our test configuration so that:
- It can be bound to MockMvc in a mocked environment
- It can be bound to a running server for integration tests on a running server.
Comment From: wilkinsona
With reference to #47410, I think we may be missing a RestTestClient equivalent of SpringBootWebTestClientBuilderCustomizer so that any HttpMessageConverter customisation is applied to the auto-configured RestTestClient.
Comment From: donalmurtagh
The documentation says that a RestTestClient instance for performing full end-to-end tests should be created via
var restTestClient = RestTestClient.bindToServer().baseUrl("http://localhost:8080").build();
If such an instance would not have any any HttpMessageConverter customisation applied to it, then the docs should be updated.
Comment From: wilkinsona
That documentation is from Spring Framework where HTTP message converter customisation is something that has to be done manually on both the client- and server-side. While it doesn't mention message converters specifically, the general topic of customisation is covered in this section. If you think this could be improved, please open a Spring Framework issue.