Validate our own tests work with JUnit5 and the vintage engine

Closes gh-14737

Co-authored-by: Stephane Nicoll <snicoll@pivotal.io>
This commit is contained in:
Madhura Bhave
2018-12-05 13:56:29 -08:00
committed by Stephane Nicoll
parent d9f339a1b6
commit 1db1c8b03c
821 changed files with 2279 additions and 2787 deletions

View File

@@ -16,15 +16,13 @@
package sample.webflux;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Mono;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.reactive.server.WebTestClient;
/**
@@ -32,21 +30,20 @@ import org.springframework.test.web.reactive.server.WebTestClient;
*
* @author Brian Clozel
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
public class SampleWebFluxApplicationTests {
class SampleWebFluxApplicationTests {
@Autowired
private WebTestClient webClient;
@Test
public void testWelcome() {
void testWelcome() {
this.webClient.get().uri("/").accept(MediaType.TEXT_PLAIN).exchange()
.expectBody(String.class).isEqualTo("Hello World");
}
@Test
public void testEcho() {
void testEcho() {
this.webClient.post().uri("/echo").contentType(MediaType.TEXT_PLAIN)
.accept(MediaType.TEXT_PLAIN)
.body(Mono.just("Hello WebFlux!"), String.class).exchange()
@@ -54,7 +51,7 @@ public class SampleWebFluxApplicationTests {
}
@Test
public void testActuatorStatus() {
void testActuatorStatus() {
this.webClient.get().uri("/actuator/health").accept(MediaType.APPLICATION_JSON)
.exchange().expectStatus().isOk().expectBody()
.json("{\"status\":\"UP\"}");