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

@@ -22,8 +22,7 @@ import java.util.concurrent.atomic.AtomicReference;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import samples.websocket.tomcat.client.GreetingService;
import samples.websocket.tomcat.client.SimpleClientWebSocketHandler;
import samples.websocket.tomcat.client.SimpleGreetingService;
@@ -38,16 +37,14 @@ import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.socket.client.WebSocketConnectionManager;
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = SampleTomcatWebSocketApplication.class,
webEnvironment = WebEnvironment.RANDOM_PORT)
public class SampleWebSocketsApplicationTests {
class SampleWebSocketsApplicationTests {
private static Log logger = LogFactory.getLog(SampleWebSocketsApplicationTests.class);
@@ -55,7 +52,7 @@ public class SampleWebSocketsApplicationTests {
private int port = 1234;
@Test
public void echoEndpoint() {
void echoEndpoint() {
ConfigurableApplicationContext context = new SpringApplicationBuilder(
ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class)
.properties("websocket.uri:ws://localhost:" + this.port
@@ -71,7 +68,7 @@ public class SampleWebSocketsApplicationTests {
}
@Test
public void reverseEndpoint() {
void reverseEndpoint() {
ConfigurableApplicationContext context = new SpringApplicationBuilder(
ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class)
.properties(

View File

@@ -22,8 +22,7 @@ import java.util.concurrent.atomic.AtomicReference;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import samples.websocket.tomcat.SampleTomcatWebSocketApplication;
import samples.websocket.tomcat.client.GreetingService;
import samples.websocket.tomcat.client.SimpleClientWebSocketHandler;
@@ -42,18 +41,16 @@ import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.socket.client.WebSocketConnectionManager;
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class)
@SpringBootTest(
classes = { SampleTomcatWebSocketApplication.class,
CustomContainerConfiguration.class },
webEnvironment = WebEnvironment.RANDOM_PORT)
public class CustomContainerWebSocketsApplicationTests {
class CustomContainerWebSocketsApplicationTests {
private static Log logger = LogFactory
.getLog(CustomContainerWebSocketsApplicationTests.class);
@@ -62,7 +59,7 @@ public class CustomContainerWebSocketsApplicationTests {
private int port;
@Test
public void echoEndpoint() {
void echoEndpoint() {
ConfigurableApplicationContext context = new SpringApplicationBuilder(
ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class)
.properties("websocket.uri:ws://localhost:" + this.port
@@ -78,7 +75,7 @@ public class CustomContainerWebSocketsApplicationTests {
}
@Test
public void reverseEndpoint() {
void reverseEndpoint() {
ConfigurableApplicationContext context = new SpringApplicationBuilder(
ClientConfiguration.class, PropertyPlaceholderAutoConfiguration.class)
.properties("websocket.uri:ws://localhost:" + this.port

View File

@@ -18,17 +18,17 @@ package samples.websocket.tomcat.snake;
import java.io.IOException;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.willThrow;
import static org.mockito.Mockito.mock;
public class SnakeTimerTests {
class SnakeTimerTests {
@Test
public void removeDysfunctionalSnakes() throws Exception {
void removeDysfunctionalSnakes() throws Exception {
Snake snake = mock(Snake.class);
willThrow(new IOException()).given(snake).sendMessage(anyString());
SnakeTimer.addSnake(snake);