Add resttemplate-to-restclient module: RestTemplate deprecation on Spring Framework 7.1 / Boot 4.2.0 vs 4.1.3, method mapping, exchange() trap, bridge URI encoding, RestTestClient, OpenRewrite recipe run, with real transcripts
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b7M7FEdeEm3APj16Bu
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
# 10-test-clients (Spring Boot 4.2.0, JDK 25)
|
||||
TestRestTemplate.getForEntity("/students/1", Student.class) -> 200 OK Student[id=1, name=Asha]
|
||||
RestTestClient.get().uri("/students/1").exchange().expectStatus().isOk().expectBody(Student.class) -> Student[id=1, name=Asha]
|
||||
TestRestTemplate on a 404 does not throw: status 404 NOT_FOUND
|
||||
RestTestClient on a 404 does not throw: expectStatus().isNotFound() passed
|
||||
TestRestTemplate.postForEntity(...) -> 201 CREATED Location /students/3
|
||||
RestTestClient.post()...body(...).exchange().expectStatus().isCreated().expectHeader().exists("Location") passed
|
||||
TestRestTemplate.withBasicAuth("user", "pw") -> server saw Authorization: Basic dXNlcjpwdw==
|
||||
RestTestClient.mutate().defaultHeaders(h -> h.setBasicAuth("user", "pw")) -> server saw Authorization: Basic dXNlcjpwdw==
|
||||
Reference in New Issue
Block a user