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,12 @@ import java.lang.management.ManagementFactory;
import javax.management.ObjectName;
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.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
@@ -43,7 +41,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
* @author Oliver Gierke
* @author Dave Syer
*/
@RunWith(SpringRunner.class)
// Enable JMX so we can test the MBeans (you can't do this in a properties file)
@SpringBootTest(properties = { "spring.jmx.enabled:true",
"spring.datasource.jmx-enabled:true" })
@@ -56,7 +54,7 @@ public class SampleDataJpaApplicationTests {
private MockMvc mvc;
@Before
@BeforeEach
public void setUp() {
this.mvc = MockMvcBuilders.webAppContextSetup(this.context).build();
}

View File

@@ -15,15 +15,13 @@
*/
package sample.data.jpa.service;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import sample.data.jpa.domain.City;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
@@ -32,7 +30,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Oliver Gierke
*/
@RunWith(SpringRunner.class)
@SpringBootTest
public class CityRepositoryIntegrationTests {

View File

@@ -17,8 +17,7 @@ package sample.data.jpa.service;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import sample.data.jpa.domain.City;
import sample.data.jpa.domain.Hotel;
import sample.data.jpa.domain.HotelSummary;
@@ -30,7 +29,6 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
@@ -39,7 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Oliver Gierke
*/
@RunWith(SpringRunner.class)
@SpringBootTest
public class HotelRepositoryIntegrationTests {