Commit 99aa1554 authored by Andy Wilkinson's avatar Andy Wilkinson

Update tests that use WebClient following changes to its API

parent bf83e74d
...@@ -91,14 +91,14 @@ public abstract class AbstractReactiveWebServerFactoryTests { ...@@ -91,14 +91,14 @@ public abstract class AbstractReactiveWebServerFactoryTests {
assertThat(this.output.toString()).contains("started on port"); assertThat(this.output.toString()).contains("started on port");
Mono<String> result = getWebClient().post().uri("/test") Mono<String> result = getWebClient().post().uri("/test")
.contentType(MediaType.TEXT_PLAIN) .contentType(MediaType.TEXT_PLAIN)
.exchange(BodyInserters.fromObject("Hello World")) .body(BodyInserters.fromObject("Hello World")).exchange()
.then(response -> response.bodyToMono(String.class)); .then(response -> response.bodyToMono(String.class));
assertThat(result.block()).isEqualTo("Hello World"); assertThat(result.block()).isEqualTo("Hello World");
this.webServer.stop(); this.webServer.stop();
Mono<ClientResponse> response = getWebClient().post().uri("/test") Mono<ClientResponse> response = getWebClient().post().uri("/test")
.contentType(MediaType.TEXT_PLAIN) .contentType(MediaType.TEXT_PLAIN)
.exchange(BodyInserters.fromObject("Hello World")); .body(BodyInserters.fromObject("Hello World")).exchange();
StepVerifier.create(response).expectError().verify(); StepVerifier.create(response).expectError().verify();
} }
...@@ -112,7 +112,7 @@ public abstract class AbstractReactiveWebServerFactoryTests { ...@@ -112,7 +112,7 @@ public abstract class AbstractReactiveWebServerFactoryTests {
Mono<String> result = WebClient.create("http://localhost:" + specificPort).post() Mono<String> result = WebClient.create("http://localhost:" + specificPort).post()
.uri("/test").contentType(MediaType.TEXT_PLAIN) .uri("/test").contentType(MediaType.TEXT_PLAIN)
.exchange(BodyInserters.fromObject("Hello World")) .body(BodyInserters.fromObject("Hello World")).exchange()
.then(response -> response.bodyToMono(String.class)); .then(response -> response.bodyToMono(String.class));
assertThat(result.block()).isEqualTo("Hello World"); assertThat(result.block()).isEqualTo("Hello World");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment