|
|
@ -40,17 +40,24 @@ public class SampleWebFluxApplicationTests {
|
|
|
|
private WebTestClient webClient;
|
|
|
|
private WebTestClient webClient;
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testWelcome() throws Exception {
|
|
|
|
public void testWelcome() {
|
|
|
|
this.webClient.get().uri("/").accept(MediaType.TEXT_PLAIN).exchange()
|
|
|
|
this.webClient.get().uri("/").accept(MediaType.TEXT_PLAIN).exchange()
|
|
|
|
.expectBody(String.class).isEqualTo("Hello World");
|
|
|
|
.expectBody(String.class).isEqualTo("Hello World");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void testEcho() throws Exception {
|
|
|
|
public void testEcho() {
|
|
|
|
this.webClient.post().uri("/echo").contentType(MediaType.TEXT_PLAIN)
|
|
|
|
this.webClient.post().uri("/echo").contentType(MediaType.TEXT_PLAIN)
|
|
|
|
.accept(MediaType.TEXT_PLAIN)
|
|
|
|
.accept(MediaType.TEXT_PLAIN)
|
|
|
|
.body(Mono.just("Hello WebFlux!"), String.class).exchange()
|
|
|
|
.body(Mono.just("Hello WebFlux!"), String.class).exchange()
|
|
|
|
.expectBody(String.class).isEqualTo("Hello WebFlux!");
|
|
|
|
.expectBody(String.class).isEqualTo("Hello WebFlux!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void testActuatorStatus() {
|
|
|
|
|
|
|
|
this.webClient.get().uri("/application/status").accept(MediaType.APPLICATION_JSON)
|
|
|
|
|
|
|
|
.exchange().expectStatus().isOk().expectBody()
|
|
|
|
|
|
|
|
.json("{\"status\":\"UP\"}");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|