Upgrade tests to Junit5

See gh-14737
This commit is contained in:
Madhura Bhave
2018-12-05 13:56:29 -08:00
parent 4c96c76f11
commit 59d2b0a3fb
804 changed files with 1976 additions and 2238 deletions

View File

@@ -20,14 +20,11 @@ import java.util.regex.Pattern;
import org.hamcrest.Description;
import org.hamcrest.TypeSafeMatcher;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
@@ -45,9 +42,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
* @author Biju Kunjummen
* @author Doo-Hwan, Kwak
*/
@RunWith(SpringRunner.class)
@WebAppConfiguration
@ContextConfiguration(classes = SampleWebUiApplication.class)
@SpringBootTest
public class MessageControllerWebTests {
@Autowired
@@ -55,7 +51,7 @@ public class MessageControllerWebTests {
private MockMvc mockMvc;
@Before
@BeforeEach
public void setup() {
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
}

View File

@@ -18,8 +18,7 @@ package sample.web.ui;
import java.net.URI;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@@ -28,7 +27,6 @@ import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
@@ -39,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Dave Syer
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
public class SampleWebUiApplicationTests {