Skip to content

Update Guidance on Best Practices To Test Code That Uses RestClient and RestTemplate #34892

Open
@rwinch

Description

@rwinch

Spring Framework provides MockRestServiceServer for testing the imperative stack (RestTemplate, RestClient, etc).

However, the team has decided not to provide similar support for WebClient because mock servers like OkHttp and Wire Mock exist. The reference documents that using mock servers like OkHttp are the preferred way to test WebClient tests.

This causes a mismatch between the imperative and reactive worlds.

It would be nice to update the imperative documentation to recommend mock servers for testing imperative clients. This would align the two stacks and make it clear what is considered best practice.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: documentationA documentation task

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions