mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-09-17 12:09:16 +00:00
Polish
This commit is contained in:
+4
-4
@@ -60,9 +60,9 @@ class MyMockMvcTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void testWithRestTestClient(@Autowired RestTestClient webClient) {
|
||||
void testWithRestTestClient(@Autowired RestTestClient restClient) {
|
||||
// @formatter:off
|
||||
webClient
|
||||
restClient
|
||||
.get().uri("/")
|
||||
.exchange()
|
||||
.expectStatus().isOk()
|
||||
@@ -71,9 +71,9 @@ class MyMockMvcTests {
|
||||
}
|
||||
|
||||
@Test // If you prefer AssertJ, dedicated assertions are available
|
||||
void testWithRestTestClientAssertJ(@Autowired RestTestClient webClient) {
|
||||
void testWithRestTestClientAssertJ(@Autowired RestTestClient restClient) {
|
||||
// @formatter:off
|
||||
ResponseSpec spec = webClient.get().uri("/").exchange();
|
||||
ResponseSpec spec = restClient.get().uri("/").exchange();
|
||||
RestTestClientResponse response = RestTestClientResponse.from(spec);
|
||||
assertThat(response).hasStatusOk()
|
||||
.bodyText().isEqualTo("Hello World");
|
||||
|
||||
+2
-2
@@ -33,9 +33,9 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
class MyRandomPortRestTestClientAssertJTests {
|
||||
|
||||
@Test
|
||||
void exampleTest(@Autowired RestTestClient webClient) {
|
||||
void exampleTest(@Autowired RestTestClient restClient) {
|
||||
// @formatter:off
|
||||
ResponseSpec spec = webClient.get().uri("/").exchange();
|
||||
ResponseSpec spec = restClient.get().uri("/").exchange();
|
||||
RestTestClientResponse response = RestTestClientResponse.from(spec);
|
||||
assertThat(response).hasStatusOk().bodyText().isEqualTo("Hello World");
|
||||
// @formatter:on
|
||||
|
||||
+2
-2
@@ -29,9 +29,9 @@ import org.springframework.test.web.servlet.client.RestTestClient;
|
||||
class MyRandomPortRestTestClientTests {
|
||||
|
||||
@Test
|
||||
void exampleTest(@Autowired RestTestClient webClient) {
|
||||
void exampleTest(@Autowired RestTestClient restClient) {
|
||||
// @formatter:off
|
||||
webClient
|
||||
restClient
|
||||
.get().uri("/")
|
||||
.exchange()
|
||||
.expectStatus().isOk()
|
||||
|
||||
Reference in New Issue
Block a user