Browse Source

Polish

pull/48950/head
Phillip Webb 2 weeks 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 {
} }
@Test @Test
void testWithRestTestClient(@Autowired RestTestClient webClient) { void testWithRestTestClient(@Autowired RestTestClient restClient) {
// @formatter:off // @formatter:off
webClient restClient
.get().uri("/") .get().uri("/")
.exchange() .exchange()
.expectStatus().isOk() .expectStatus().isOk()
@ -71,9 +71,9 @@ class MyMockMvcTests {
} }
@Test // If you prefer AssertJ, dedicated assertions are available @Test // If you prefer AssertJ, dedicated assertions are available
void testWithRestTestClientAssertJ(@Autowired RestTestClient webClient) { void testWithRestTestClientAssertJ(@Autowired RestTestClient restClient) {
// @formatter:off // @formatter:off
ResponseSpec spec = webClient.get().uri("/").exchange(); ResponseSpec spec = restClient.get().uri("/").exchange();
RestTestClientResponse response = RestTestClientResponse.from(spec); RestTestClientResponse response = RestTestClientResponse.from(spec);
assertThat(response).hasStatusOk() assertThat(response).hasStatusOk()
.bodyText().isEqualTo("Hello World"); .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;
class MyRandomPortRestTestClientAssertJTests { class MyRandomPortRestTestClientAssertJTests {
@Test @Test
void exampleTest(@Autowired RestTestClient webClient) { void exampleTest(@Autowired RestTestClient restClient) {
// @formatter:off // @formatter:off
ResponseSpec spec = webClient.get().uri("/").exchange(); ResponseSpec spec = restClient.get().uri("/").exchange();
RestTestClientResponse response = RestTestClientResponse.from(spec); RestTestClientResponse response = RestTestClientResponse.from(spec);
assertThat(response).hasStatusOk().bodyText().isEqualTo("Hello World"); assertThat(response).hasStatusOk().bodyText().isEqualTo("Hello World");
// @formatter:on // @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;
class MyRandomPortRestTestClientTests { class MyRandomPortRestTestClientTests {
@Test @Test
void exampleTest(@Autowired RestTestClient webClient) { void exampleTest(@Autowired RestTestClient restClient) {
// @formatter:off // @formatter:off
webClient restClient
.get().uri("/") .get().uri("/")
.exchange() .exchange()
.expectStatus().isOk() .expectStatus().isOk()

Loading…
Cancel
Save