Browse Source

Polish

pull/48950/head
Phillip Webb 1 week ago
parent
commit
abec26e504
  1. 8
      documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/springbootapplications/withmockenvironment/MyMockMvcTests.java
  2. 4
      documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/springbootapplications/withrunningserver/MyRandomPortRestTestClientAssertJTests.java
  3. 4
      documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/springbootapplications/withrunningserver/MyRandomPortRestTestClientTests.java

8
documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/springbootapplications/withmockenvironment/MyMockMvcTests.java

@ -60,9 +60,9 @@ class MyMockMvcTests { @@ -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 { @@ -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");

4
documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/springbootapplications/withrunningserver/MyRandomPortRestTestClientAssertJTests.java

@ -33,9 +33,9 @@ import static org.assertj.core.api.Assertions.assertThat; @@ -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

4
documentation/spring-boot-docs/src/main/java/org/springframework/boot/docs/testing/springbootapplications/withrunningserver/MyRandomPortRestTestClientTests.java

@ -29,9 +29,9 @@ import org.springframework.test.web.servlet.client.RestTestClient; @@ -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()

Loading…
Cancel
Save