Skip to content

Commit e9e1cc1

Browse files
committed
Merge pull request #26227 from crocarneiro
* gh-26227: Polish "Improve documentation of TestRestTemplate's fault tolerance" Improve documentation of TestRestTemplate's fault tolerance Closes gh-26227
2 parents f4fd81f + be807ba commit e9e1cc1

File tree

2 files changed

+70
-98
lines changed

2 files changed

+70
-98
lines changed

spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7606,7 +7606,9 @@ include::{test-examples}/test/system/OutputCaptureTests.java[tag=test]
76067606
==== TestRestTemplate
76077607
`TestRestTemplate` is a convenience alternative to Spring's `RestTemplate` that is useful in integration tests.
76087608
You can get a vanilla template or one that sends Basic HTTP authentication (with a username and password).
7609-
In either case, the template behaves in a test-friendly way by not throwing exceptions on server-side errors.
7609+
In either case, the template is fault tolerant.
7610+
This means that it behaves in a test-friendly way by not throwing exceptions on 4xx and 5xx errors.
7611+
Instead, such errors can be detected via the returned `ResponseEntity` and its status code.
76107612

76117613
TIP: Spring Framework 5.0 provides a new `WebTestClient` that works for <<boot-features-testing-spring-boot-applications-testing-autoconfigured-webflux-tests, WebFlux integration tests>> and both <<boot-features-testing-spring-boot-applications-testing-with-running-server, WebFlux and MVC end-to-end testing>>.
76127614
It provides a fluent API for assertions, unlike `TestRestTemplate`.

0 commit comments

Comments
 (0)