diff --git a/jpa/eclipselink/src/test/java/example/springdata/jpa/eclipselink/CustomerRepositoryIntegrationTests.java b/jpa/eclipselink/src/test/java/example/springdata/jpa/eclipselink/CustomerRepositoryIntegrationTests.java index 4ef97ad7..ece3dd86 100644 --- a/jpa/eclipselink/src/test/java/example/springdata/jpa/eclipselink/CustomerRepositoryIntegrationTests.java +++ b/jpa/eclipselink/src/test/java/example/springdata/jpa/eclipselink/CustomerRepositoryIntegrationTests.java @@ -19,18 +19,18 @@ import static org.assertj.core.api.Assertions.*; import javax.transaction.Transactional; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; /** * Integration test for {@link CustomerRepository}. * * @author Oliver Gierke */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @SpringBootTest @Transactional public class CustomerRepositoryIntegrationTests { diff --git a/jpa/example/src/test/java/example/springdata/jpa/auditing/AuditableUserSample.java b/jpa/example/src/test/java/example/springdata/jpa/auditing/AuditableUserSample.java index 15644a69..269be31d 100644 --- a/jpa/example/src/test/java/example/springdata/jpa/auditing/AuditableUserSample.java +++ b/jpa/example/src/test/java/example/springdata/jpa/auditing/AuditableUserSample.java @@ -15,15 +15,16 @@ */ package example.springdata.jpa.auditing; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.MatcherAssert.assertThat; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.jpa.domain.support.AuditingEntityListener; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.util.ReflectionTestUtils; import org.springframework.transaction.annotation.Transactional; @@ -31,7 +32,7 @@ import org.springframework.transaction.annotation.Transactional; * @author Oliver Gierke * @author Thomas Darimont */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @Transactional @SpringBootTest public class AuditableUserSample { @@ -43,7 +44,7 @@ public class AuditableUserSample { @Test public void auditEntityCreation() throws Exception { - assertThat(ReflectionTestUtils.getField(listener, "handler"), is(notNullValue())); + assertThat(ReflectionTestUtils.getField(listener, "handler"),is(notNullValue())); AuditableUser user = new AuditableUser(); user.setUsername("username"); diff --git a/jpa/example/src/test/java/example/springdata/jpa/basics/BasicFactorySetup.java b/jpa/example/src/test/java/example/springdata/jpa/basics/BasicFactorySetup.java index 1c51d77d..a5b58715 100644 --- a/jpa/example/src/test/java/example/springdata/jpa/basics/BasicFactorySetup.java +++ b/jpa/example/src/test/java/example/springdata/jpa/basics/BasicFactorySetup.java @@ -24,9 +24,9 @@ import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.data.jpa.repository.support.JpaRepositoryFactory; /** @@ -48,7 +48,7 @@ public class BasicFactorySetup { * * @throws Exception */ - @Before + @BeforeEach public void setUp() { em = factory.createEntityManager(); @@ -69,7 +69,7 @@ public class BasicFactorySetup { /** * Rollback transaction. */ - @After + @AfterEach public void tearDown() { em.getTransaction().rollback(); diff --git a/jpa/example/src/test/java/example/springdata/jpa/basics/BasicSample.java b/jpa/example/src/test/java/example/springdata/jpa/basics/BasicSample.java index 4637fa05..cdca11c0 100644 --- a/jpa/example/src/test/java/example/springdata/jpa/basics/BasicSample.java +++ b/jpa/example/src/test/java/example/springdata/jpa/basics/BasicSample.java @@ -27,9 +27,9 @@ import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; import javax.persistence.Persistence; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.springframework.data.jpa.repository.support.SimpleJpaRepository; import org.springframework.data.repository.CrudRepository; @@ -47,7 +47,7 @@ public class BasicSample { /** * Sets up a {@link SimpleJpaRepository} instance. */ - @Before + @BeforeEach public void setUp() { EntityManagerFactory factory = Persistence.createEntityManagerFactory("jpa.sample.plain"); @@ -58,7 +58,7 @@ public class BasicSample { em.getTransaction().begin(); } - @After + @AfterEach public void tearDown() { em.getTransaction().rollback(); } diff --git a/jpa/example/src/test/java/example/springdata/jpa/caching/CachingRepositoryTests.java b/jpa/example/src/test/java/example/springdata/jpa/caching/CachingRepositoryTests.java index 1fc61340..3f8825c5 100644 --- a/jpa/example/src/test/java/example/springdata/jpa/caching/CachingRepositoryTests.java +++ b/jpa/example/src/test/java/example/springdata/jpa/caching/CachingRepositoryTests.java @@ -15,16 +15,16 @@ */ package example.springdata.jpa.caching; -import static org.assertj.core.api.Assertions.*; +import static org.assertj.core.api.Assertions.assertThat; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.cache.Cache; import org.springframework.cache.CacheManager; import org.springframework.cache.annotation.Cacheable; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.annotation.Transactional; /** @@ -34,7 +34,7 @@ import org.springframework.transaction.annotation.Transactional; * @author Thomas Darimont * @author Andrea Rizzini */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @Transactional @SpringBootTest public class CachingRepositoryTests { diff --git a/jpa/example/src/test/java/example/springdata/jpa/compositions/ComposedRepositoryTests.java b/jpa/example/src/test/java/example/springdata/jpa/compositions/ComposedRepositoryTests.java index 2149987d..b3bd86c2 100644 --- a/jpa/example/src/test/java/example/springdata/jpa/compositions/ComposedRepositoryTests.java +++ b/jpa/example/src/test/java/example/springdata/jpa/compositions/ComposedRepositoryTests.java @@ -15,15 +15,15 @@ */ package example.springdata.jpa.compositions; -import static org.assertj.core.api.Assertions.*; +import static org.assertj.core.api.Assertions.assertThat; import java.util.Arrays; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.annotation.Transactional; /** @@ -31,7 +31,7 @@ import org.springframework.transaction.annotation.Transactional; * * @author Mark Paluch */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @Transactional @SpringBootTest public class ComposedRepositoryTests { diff --git a/jpa/example/src/test/java/example/springdata/jpa/custom/UserRepositoryCustomizationTests.java b/jpa/example/src/test/java/example/springdata/jpa/custom/UserRepositoryCustomizationTests.java index b1c32b21..f474b39c 100644 --- a/jpa/example/src/test/java/example/springdata/jpa/custom/UserRepositoryCustomizationTests.java +++ b/jpa/example/src/test/java/example/springdata/jpa/custom/UserRepositoryCustomizationTests.java @@ -15,15 +15,15 @@ */ package example.springdata.jpa.custom; -import static org.assertj.core.api.Assertions.*; +import static org.assertj.core.api.Assertions.assertThat; import java.util.List; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.annotation.Transactional; /** @@ -32,7 +32,7 @@ import org.springframework.transaction.annotation.Transactional; * @author Oliver Gierke * @author Thomas Darimont */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @Transactional @SpringBootTest // @ActiveProfiles("jdbc") // Uncomment @ActiveProfiles to enable the JDBC Implementation of the custom repository diff --git a/jpa/example/src/test/java/example/springdata/jpa/customall/UserRepositoryCustomizationTests.java b/jpa/example/src/test/java/example/springdata/jpa/customall/UserRepositoryCustomizationTests.java index 08e66bf7..03825807 100644 --- a/jpa/example/src/test/java/example/springdata/jpa/customall/UserRepositoryCustomizationTests.java +++ b/jpa/example/src/test/java/example/springdata/jpa/customall/UserRepositoryCustomizationTests.java @@ -15,13 +15,13 @@ */ package example.springdata.jpa.customall; -import static org.assertj.core.api.Assertions.*; +import static org.assertj.core.api.Assertions.assertThat; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.annotation.Transactional; /** @@ -30,7 +30,7 @@ import org.springframework.transaction.annotation.Transactional; * @author Oliver Gierke * @soundtrack Elen - It's you (Elen) */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @Transactional @SpringBootTest public class UserRepositoryCustomizationTests { diff --git a/jpa/example/src/test/java/example/springdata/jpa/projections/CustomerRepositoryIntegrationTest.java b/jpa/example/src/test/java/example/springdata/jpa/projections/CustomerRepositoryIntegrationTest.java index 05c85f53..670a31c2 100644 --- a/jpa/example/src/test/java/example/springdata/jpa/projections/CustomerRepositoryIntegrationTest.java +++ b/jpa/example/src/test/java/example/springdata/jpa/projections/CustomerRepositoryIntegrationTest.java @@ -15,14 +15,14 @@ */ package example.springdata.jpa.projections; -import static org.assertj.core.api.Assertions.*; +import static org.assertj.core.api.Assertions.assertThat; import java.util.Collection; import java.util.Map; -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.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.test.context.SpringBootTest; @@ -32,7 +32,7 @@ import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort.Direction; import org.springframework.data.projection.TargetAware; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.annotation.Transactional; /** @@ -40,7 +40,7 @@ import org.springframework.transaction.annotation.Transactional; * * @author Oliver Gierke */ -@RunWith(SpringJUnit4ClassRunner.class) +@ExtendWith(SpringExtension.class) @SpringBootTest @Transactional public class CustomerRepositoryIntegrationTest { @@ -53,7 +53,7 @@ public class CustomerRepositoryIntegrationTest { Customer dave, carter; - @Before + @BeforeEach public void setUp() { this.dave = customers.save(new Customer("Dave", "Matthews")); diff --git a/jpa/example/src/test/java/example/springdata/jpa/simple/SimpleUserRepositoryTests.java b/jpa/example/src/test/java/example/springdata/jpa/simple/SimpleUserRepositoryTests.java index 1e1b2c4f..d22917c2 100644 --- a/jpa/example/src/test/java/example/springdata/jpa/simple/SimpleUserRepositoryTests.java +++ b/jpa/example/src/test/java/example/springdata/jpa/simple/SimpleUserRepositoryTests.java @@ -16,24 +16,27 @@ package example.springdata.jpa.simple; import static org.assertj.core.api.Assertions.assertThat; -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.assertThat; -import static org.springframework.data.domain.Sort.Direction.*; +import static org.hamcrest.Matchers.hasItems; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.iterableWithSize; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.springframework.data.domain.Sort.Direction.ASC; +import static org.springframework.data.domain.Sort.Direction.DESC; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Optional; -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.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Slice; import org.springframework.data.domain.Sort; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.annotation.Transactional; /** @@ -43,7 +46,7 @@ import org.springframework.transaction.annotation.Transactional; * @author Thomas Darimont * @author Christoph Strobl */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @Transactional @SpringBootTest public class SimpleUserRepositoryTests { @@ -51,7 +54,7 @@ public class SimpleUserRepositoryTests { @Autowired SimpleUserRepository repository; User user; - @Before + @BeforeEach public void setUp() { user = new User(); diff --git a/jpa/interceptors/src/test/java/example/springdata/jpa/interceptors/InterceptorIntegrationTest.java b/jpa/interceptors/src/test/java/example/springdata/jpa/interceptors/InterceptorIntegrationTest.java index 71eeaf6a..ff5fe1b5 100644 --- a/jpa/interceptors/src/test/java/example/springdata/jpa/interceptors/InterceptorIntegrationTest.java +++ b/jpa/interceptors/src/test/java/example/springdata/jpa/interceptors/InterceptorIntegrationTest.java @@ -15,13 +15,13 @@ */ package example.springdata.jpa.interceptors; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @SpringBootTest public class InterceptorIntegrationTest { diff --git a/jpa/java8/src/test/java/example/springdata/jpa/java8/Java8IntegrationTests.java b/jpa/java8/src/test/java/example/springdata/jpa/java8/Java8IntegrationTests.java index 53e130c6..7a5ed564 100644 --- a/jpa/java8/src/test/java/example/springdata/jpa/java8/Java8IntegrationTests.java +++ b/jpa/java8/src/test/java/example/springdata/jpa/java8/Java8IntegrationTests.java @@ -25,12 +25,13 @@ import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.dao.InvalidDataAccessApiUsageException; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; @@ -40,7 +41,7 @@ import org.springframework.transaction.annotation.Transactional; * @author Oliver Gierke * @author Thomas Darimont */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @SpringBootTest @Transactional @Slf4j @@ -109,10 +110,12 @@ public class Java8IntegrationTests { * Query methods using streaming need to be used inside a surrounding transaction to keep the connection open while * the stream is consumed. We simulate that not being the case by actively disabling the transaction here. */ - @Test(expected = InvalidDataAccessApiUsageException.class) + @Test @Transactional(propagation = Propagation.NOT_SUPPORTED) public void rejectsStreamExecutionIfNoSurroundingTransactionActive() { - repository.findAllByLastnameIsNotNull(); + Assertions.assertThrows(InvalidDataAccessApiUsageException.class, () -> { + repository.findAllByLastnameIsNotNull(); + }); } /** diff --git a/jpa/jpa21/src/test/java/example/springdata/jpa/fetchgraph/FetchGraphIntegrationTests.java b/jpa/jpa21/src/test/java/example/springdata/jpa/fetchgraph/FetchGraphIntegrationTests.java index b9b3c2d7..5bfca1c6 100644 --- a/jpa/jpa21/src/test/java/example/springdata/jpa/fetchgraph/FetchGraphIntegrationTests.java +++ b/jpa/jpa21/src/test/java/example/springdata/jpa/fetchgraph/FetchGraphIntegrationTests.java @@ -15,18 +15,19 @@ */ package example.springdata.jpa.fetchgraph; -import static org.assertj.core.api.Assertions.*; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import java.util.Collections; import javax.persistence.EntityManager; import org.hibernate.LazyInitializationException; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.annotation.Transactional; /** @@ -35,7 +36,8 @@ import org.springframework.transaction.annotation.Transactional; * @author Thomas Darimont * @author Jens Schauder */ -@RunWith(SpringRunner.class) + +@ExtendWith(SpringExtension.class) @Transactional @SpringBootTest(classes = FetchGraphConfiguration.class) public class FetchGraphIntegrationTests { diff --git a/jpa/jpa21/src/test/java/example/springdata/jpa/resultsetmappings/SubscriptionRepositoryIntegrationTests.java b/jpa/jpa21/src/test/java/example/springdata/jpa/resultsetmappings/SubscriptionRepositoryIntegrationTests.java index 29874473..35ccd996 100644 --- a/jpa/jpa21/src/test/java/example/springdata/jpa/resultsetmappings/SubscriptionRepositoryIntegrationTests.java +++ b/jpa/jpa21/src/test/java/example/springdata/jpa/resultsetmappings/SubscriptionRepositoryIntegrationTests.java @@ -15,21 +15,21 @@ */ package example.springdata.jpa.resultsetmappings; -import static java.util.Arrays.*; -import static org.assertj.core.api.Assertions.*; +import static java.util.Arrays.asList; +import static org.assertj.core.api.Assertions.assertThat; -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.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.annotation.Transactional; /** * @author Thomas Darimont */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @DataJpaTest @Transactional public class SubscriptionRepositoryIntegrationTests { @@ -39,7 +39,7 @@ public class SubscriptionRepositoryIntegrationTests { @Autowired SubscriptionRepository repository; - @Before + @BeforeEach public void setUp() { repository.save(new Subscription(SERVICE_1, 1)); diff --git a/jpa/jpa21/src/test/java/example/springdata/jpa/storedprocedures/UserRepositoryIntegrationTests.java b/jpa/jpa21/src/test/java/example/springdata/jpa/storedprocedures/UserRepositoryIntegrationTests.java index 0f586ac1..c6262e8f 100644 --- a/jpa/jpa21/src/test/java/example/springdata/jpa/storedprocedures/UserRepositoryIntegrationTests.java +++ b/jpa/jpa21/src/test/java/example/springdata/jpa/storedprocedures/UserRepositoryIntegrationTests.java @@ -16,17 +16,17 @@ package example.springdata.jpa.storedprocedures; import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; +import static org.hamcrest.MatcherAssert.assertThat; import javax.persistence.EntityManager; import javax.persistence.ParameterMode; import javax.persistence.StoredProcedureQuery; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.annotation.Transactional; /** @@ -35,7 +35,7 @@ import org.springframework.transaction.annotation.Transactional; * @author Thomas Darimont * @author Oliver Gierke */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @SpringBootTest @Transactional public class UserRepositoryIntegrationTests { diff --git a/jpa/multiple-datasources/src/test/java/example/springdata/jpa/multipleds/customer/CustomerRepositoryTests.java b/jpa/multiple-datasources/src/test/java/example/springdata/jpa/multipleds/customer/CustomerRepositoryTests.java index 1d18dab2..1eff41b8 100644 --- a/jpa/multiple-datasources/src/test/java/example/springdata/jpa/multipleds/customer/CustomerRepositoryTests.java +++ b/jpa/multiple-datasources/src/test/java/example/springdata/jpa/multipleds/customer/CustomerRepositoryTests.java @@ -15,19 +15,20 @@ */ package example.springdata.jpa.multipleds.customer; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.MatcherAssert.assertThat; import java.util.Optional; import javax.persistence.EntityManager; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.annotation.Transactional; /** @@ -35,7 +36,7 @@ import org.springframework.transaction.annotation.Transactional; * * @author Oliver Gierke */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @SpringBootTest @Transactional(transactionManager = "customerTransactionManager") public class CustomerRepositoryTests { diff --git a/jpa/multiple-datasources/src/test/java/example/springdata/jpa/multipleds/order/OrderRepositoryTests.java b/jpa/multiple-datasources/src/test/java/example/springdata/jpa/multipleds/order/OrderRepositoryTests.java index fc0f93d1..3879ca00 100644 --- a/jpa/multiple-datasources/src/test/java/example/springdata/jpa/multipleds/order/OrderRepositoryTests.java +++ b/jpa/multiple-datasources/src/test/java/example/springdata/jpa/multipleds/order/OrderRepositoryTests.java @@ -15,24 +15,24 @@ */ package example.springdata.jpa.multipleds.order; -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.*; +import static org.hamcrest.Matchers.hasSize; +import static org.hamcrest.MatcherAssert.assertThat; -import example.springdata.jpa.multipleds.customer.CustomerRepository; - -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.annotation.Transactional; +import example.springdata.jpa.multipleds.customer.CustomerRepository; + /** * Integration test for {@link CustomerRepository}. * * @author Oliver Gierke */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @SpringBootTest @Transactional(transactionManager = "orderTransactionManager") public class OrderRepositoryTests { diff --git a/jpa/query-by-example/src/test/java/example/springdata/jpa/querybyexample/UserRepositoryInheritanceIntegrationTests.java b/jpa/query-by-example/src/test/java/example/springdata/jpa/querybyexample/UserRepositoryInheritanceIntegrationTests.java index e0efa1b3..7a030cd3 100644 --- a/jpa/query-by-example/src/test/java/example/springdata/jpa/querybyexample/UserRepositoryInheritanceIntegrationTests.java +++ b/jpa/query-by-example/src/test/java/example/springdata/jpa/querybyexample/UserRepositoryInheritanceIntegrationTests.java @@ -15,16 +15,16 @@ */ package example.springdata.jpa.querybyexample; -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; -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.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.domain.Example; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.annotation.Transactional; /** @@ -34,7 +34,7 @@ import org.springframework.transaction.annotation.Transactional; * @author Mark Paluch * @author Oliver Gierke */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @Transactional @SpringBootTest public class UserRepositoryInheritanceIntegrationTests { @@ -43,7 +43,7 @@ public class UserRepositoryInheritanceIntegrationTests { User skyler, walter, flynn; - @Before + @BeforeEach public void setUp() { repository.deleteAll(); diff --git a/jpa/query-by-example/src/test/java/example/springdata/jpa/querybyexample/UserRepositoryIntegrationTests.java b/jpa/query-by-example/src/test/java/example/springdata/jpa/querybyexample/UserRepositoryIntegrationTests.java index fd906d18..abeff748 100644 --- a/jpa/query-by-example/src/test/java/example/springdata/jpa/querybyexample/UserRepositoryIntegrationTests.java +++ b/jpa/query-by-example/src/test/java/example/springdata/jpa/querybyexample/UserRepositoryIntegrationTests.java @@ -15,20 +15,21 @@ */ package example.springdata.jpa.querybyexample; -import static org.assertj.core.api.Assertions.*; -import static org.springframework.data.domain.ExampleMatcher.*; -import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.*; +import static org.assertj.core.api.Assertions.assertThat; +import static org.springframework.data.domain.ExampleMatcher.matching; +import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.ignoreCase; +import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.startsWith; import java.util.Optional; -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.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.domain.Example; import org.springframework.data.domain.ExampleMatcher.StringMatcher; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.annotation.Transactional; /** @@ -38,7 +39,7 @@ import org.springframework.transaction.annotation.Transactional; * @author Oliver Gierke * @author Jens Schauder */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @Transactional @SpringBootTest public class UserRepositoryIntegrationTests { @@ -47,7 +48,7 @@ public class UserRepositoryIntegrationTests { User skyler, walter, flynn, marie, hank; - @Before + @BeforeEach public void setUp() { repository.deleteAll(); diff --git a/jpa/security/src/test/java/example/springdata/jpa/security/SecurityIntegrationTests.java b/jpa/security/src/test/java/example/springdata/jpa/security/SecurityIntegrationTests.java index a57a449f..7a3b29ae 100644 --- a/jpa/security/src/test/java/example/springdata/jpa/security/SecurityIntegrationTests.java +++ b/jpa/security/src/test/java/example/springdata/jpa/security/SecurityIntegrationTests.java @@ -15,21 +15,24 @@ */ package example.springdata.jpa.security; -import static java.util.Collections.*; -import static org.hamcrest.Matchers.*; -import static org.junit.Assert.*; +import static java.util.Collections.singleton; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.hasSize; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.notNullValue; +import static org.hamcrest.MatcherAssert.assertThat; import java.util.List; -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.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.annotation.Transactional; /** @@ -38,7 +41,7 @@ import org.springframework.transaction.annotation.Transactional; * @author Oliver Gierke * @author Thomas Darimont */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @SpringBootTest @Transactional public class SecurityIntegrationTests { @@ -51,7 +54,7 @@ public class SecurityIntegrationTests { UsernamePasswordAuthenticationToken olliAuth, tomAuth, adminAuth; BusinessObject object1, object2, object3; - @Before + @BeforeEach public void setup() { tom = userRepository.save(new User("thomas", "darimont", "tdarimont@example.org")); diff --git a/jpa/showcase/src/test/java/example/springdata/jpa/showcase/AbstractShowcaseContextTests.java b/jpa/showcase/src/test/java/example/springdata/jpa/showcase/AbstractShowcaseContextTests.java new file mode 100644 index 00000000..fbf81898 --- /dev/null +++ b/jpa/showcase/src/test/java/example/springdata/jpa/showcase/AbstractShowcaseContextTests.java @@ -0,0 +1,51 @@ +/** + * + */ +package example.springdata.jpa.showcase; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.lang.Nullable; +import org.springframework.test.context.TestExecutionListeners; +import org.springframework.test.context.event.EventPublishingTestExecutionListener; +import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; +import org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener; +import org.springframework.test.context.support.DirtiesContextTestExecutionListener; +import org.springframework.test.context.web.ServletTestExecutionListener; + +/** + * + */ +@ExtendWith(SpringExtension.class) +@TestExecutionListeners({ ServletTestExecutionListener.class, DirtiesContextBeforeModesTestExecutionListener.class, + DependencyInjectionTestExecutionListener.class, DirtiesContextTestExecutionListener.class, + EventPublishingTestExecutionListener.class }) +public abstract class AbstractShowcaseContextTests implements ApplicationContextAware { + + /** + * Logger available to subclasses. + */ + protected final Log logger = LogFactory.getLog(getClass()); + + /** + * The {@link ApplicationContext} that was injected into this test instance via + * {@link #setApplicationContext(ApplicationContext)}. + */ + @Nullable protected ApplicationContext applicationContext; + + /** + * Set the {@link ApplicationContext} to be used by this test instance, provided via {@link ApplicationContextAware} + * semantics. + * + * @param applicationContext the ApplicationContext that this test runs in + */ + @Override + public final void setApplicationContext(final ApplicationContext applicationContext) { + this.applicationContext = applicationContext; + } + +} diff --git a/jpa/showcase/src/test/java/example/springdata/jpa/showcase/AbstractShowcaseTest.java b/jpa/showcase/src/test/java/example/springdata/jpa/showcase/AbstractShowcaseTest.java index 6524131b..3d9b9055 100644 --- a/jpa/showcase/src/test/java/example/springdata/jpa/showcase/AbstractShowcaseTest.java +++ b/jpa/showcase/src/test/java/example/springdata/jpa/showcase/AbstractShowcaseTest.java @@ -15,9 +15,10 @@ */ package example.springdata.jpa.showcase; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.context.transaction.BeforeTransaction; import org.springframework.transaction.annotation.Transactional; @@ -26,7 +27,8 @@ import org.springframework.transaction.annotation.Transactional; */ @SpringBootTest @Transactional -public abstract class AbstractShowcaseTest extends AbstractTransactionalJUnit4SpringContextTests { +@ExtendWith(SpringExtension.class) +public abstract class AbstractShowcaseTest extends AbstractTransactionalShowcaseContextTests { @SpringBootApplication static class TestConfig {} diff --git a/jpa/showcase/src/test/java/example/springdata/jpa/showcase/AbstractTransactionalShowcaseContextTests.java b/jpa/showcase/src/test/java/example/springdata/jpa/showcase/AbstractTransactionalShowcaseContextTests.java new file mode 100644 index 00000000..813cfbee --- /dev/null +++ b/jpa/showcase/src/test/java/example/springdata/jpa/showcase/AbstractTransactionalShowcaseContextTests.java @@ -0,0 +1,150 @@ +/** + * + */ +package example.springdata.jpa.showcase; + +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.Resource; +import org.springframework.dao.DataAccessException; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; +import org.springframework.lang.Nullable; +import org.springframework.test.context.TestExecutionListeners; +import org.springframework.test.context.event.EventPublishingTestExecutionListener; +import org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener; +import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; +import org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener; +import org.springframework.test.context.support.DirtiesContextTestExecutionListener; +import org.springframework.test.context.transaction.TransactionalTestExecutionListener; +import org.springframework.test.context.web.ServletTestExecutionListener; +import org.springframework.test.jdbc.JdbcTestUtils; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.Assert; + +/** + * + */ +@TestExecutionListeners(listeners = { ServletTestExecutionListener.class, + DirtiesContextBeforeModesTestExecutionListener.class, DependencyInjectionTestExecutionListener.class, + DirtiesContextTestExecutionListener.class, TransactionalTestExecutionListener.class, + SqlScriptsTestExecutionListener.class, EventPublishingTestExecutionListener.class }, inheritListeners = false) + @Transactional +public class AbstractTransactionalShowcaseContextTests extends AbstractShowcaseContextTests{ + + /** + * The {@code JdbcTemplate} that this base class manages, available to subclasses. + * @since 3.2 + */ + protected final JdbcTemplate jdbcTemplate = new JdbcTemplate(); + + @Nullable + private String sqlScriptEncoding; + + + /** + * Set the {@code DataSource}, typically provided via Dependency Injection. + *
This method also instantiates the {@link #jdbcTemplate} instance variable. + */ + @Autowired + public void setDataSource(DataSource dataSource) { + this.jdbcTemplate.setDataSource(dataSource); + } + + /** + * Specify the encoding for SQL scripts, if different from the platform encoding. + * @see #executeSqlScript + */ + public void setSqlScriptEncoding(String sqlScriptEncoding) { + this.sqlScriptEncoding = sqlScriptEncoding; + } + + /** + * Convenience method for counting the rows in the given table. + * @param tableName table name to count rows in + * @return the number of rows in the table + * @see JdbcTestUtils#countRowsInTable + */ + protected int countRowsInTable(String tableName) { + return JdbcTestUtils.countRowsInTable(this.jdbcTemplate, tableName); + } + + /** + * Convenience method for counting the rows in the given table, using the + * provided {@code WHERE} clause. + *
See the Javadoc for {@link JdbcTestUtils#countRowsInTableWhere} for details. + * @param tableName the name of the table to count rows in + * @param whereClause the {@code WHERE} clause to append to the query + * @return the number of rows in the table that match the provided + * {@code WHERE} clause + * @since 3.2 + * @see JdbcTestUtils#countRowsInTableWhere + */ + protected int countRowsInTableWhere(String tableName, String whereClause) { + return JdbcTestUtils.countRowsInTableWhere(this.jdbcTemplate, tableName, whereClause); + } + + /** + * Convenience method for deleting all rows from the specified tables. + *
Use with caution outside of a transaction! + * @param names the names of the tables from which to delete + * @return the total number of rows deleted from all specified tables + * @see JdbcTestUtils#deleteFromTables + */ + protected int deleteFromTables(String... names) { + return JdbcTestUtils.deleteFromTables(this.jdbcTemplate, names); + } + + /** + * Convenience method for deleting all rows from the given table, using the + * provided {@code WHERE} clause. + *
Use with caution outside of a transaction! + *
See the Javadoc for {@link JdbcTestUtils#deleteFromTableWhere} for details. + * @param tableName the name of the table to delete rows from + * @param whereClause the {@code WHERE} clause to append to the query + * @param args arguments to bind to the query (leaving it to the {@code + * PreparedStatement} to guess the corresponding SQL type); may also contain + * {@link org.springframework.jdbc.core.SqlParameterValue SqlParameterValue} + * objects which indicate not only the argument value but also the SQL type + * and optionally the scale. + * @return the number of rows deleted from the table + * @since 4.0 + * @see JdbcTestUtils#deleteFromTableWhere + */ + protected int deleteFromTableWhere(String tableName, String whereClause, Object... args) { + return JdbcTestUtils.deleteFromTableWhere(this.jdbcTemplate, tableName, whereClause, args); + } + + /** + * Convenience method for dropping all of the specified tables. + *
Use with caution outside of a transaction! + * @param names the names of the tables to drop + * @since 3.2 + * @see JdbcTestUtils#dropTables + */ + protected void dropTables(String... names) { + JdbcTestUtils.dropTables(this.jdbcTemplate, names); + } + + /** + * Execute the given SQL script. + *
Use with caution outside of a transaction! + *
The script will normally be loaded by classpath. + *
Do not use this method to execute DDL if you expect rollback. + * @param sqlResourcePath the Spring resource path for the SQL script + * @param continueOnError whether or not to continue without throwing an + * exception in the event of an error + * @throws DataAccessException if there is an error executing a statement + * @see ResourceDatabasePopulator + * @see #setSqlScriptEncoding + */ + protected void executeSqlScript(String sqlResourcePath, boolean continueOnError) throws DataAccessException { + DataSource ds = this.jdbcTemplate.getDataSource(); + Assert.state(ds != null, "No DataSource set"); + Assert.state(this.applicationContext != null, "No ApplicationContext set"); + Resource resource = this.applicationContext.getResource(sqlResourcePath); + new ResourceDatabasePopulator(continueOnError, false, this.sqlScriptEncoding, resource).execute(ds); + } + +} diff --git a/jpa/showcase/src/test/java/example/springdata/jpa/showcase/after/AccountRepositoryIntegrationTest.java b/jpa/showcase/src/test/java/example/springdata/jpa/showcase/after/AccountRepositoryIntegrationTest.java index e4245759..f6d1f0b6 100644 --- a/jpa/showcase/src/test/java/example/springdata/jpa/showcase/after/AccountRepositoryIntegrationTest.java +++ b/jpa/showcase/src/test/java/example/springdata/jpa/showcase/after/AccountRepositoryIntegrationTest.java @@ -25,7 +25,7 @@ import java.util.Collections; import java.util.List; import java.util.Optional; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; /** @@ -40,7 +40,6 @@ public class AccountRepositoryIntegrationTest extends AbstractShowcaseTest { @Test public void savesAccount() { - Account account = accountRepository.save(new Account()); assertThat(account.getId()).isNotNull(); diff --git a/jpa/showcase/src/test/java/example/springdata/jpa/showcase/after/CustomerRepositoryIntegrationTest.java b/jpa/showcase/src/test/java/example/springdata/jpa/showcase/after/CustomerRepositoryIntegrationTest.java index bec7bfea..f97bbc7d 100644 --- a/jpa/showcase/src/test/java/example/springdata/jpa/showcase/after/CustomerRepositoryIntegrationTest.java +++ b/jpa/showcase/src/test/java/example/springdata/jpa/showcase/after/CustomerRepositoryIntegrationTest.java @@ -17,6 +17,7 @@ package example.springdata.jpa.showcase.after; import static example.springdata.jpa.showcase.snippets.CustomerSpecifications.*; import static org.assertj.core.api.Assertions.*; + import example.springdata.jpa.showcase.AbstractShowcaseTest; import example.springdata.jpa.showcase.core.Customer; @@ -24,7 +25,7 @@ import java.time.LocalDate; import java.util.List; import java.util.Optional; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; diff --git a/jpa/showcase/src/test/java/example/springdata/jpa/showcase/before/AccountServiceIntegrationTest.java b/jpa/showcase/src/test/java/example/springdata/jpa/showcase/before/AccountServiceIntegrationTest.java index dce6c2cb..b3dba7e2 100644 --- a/jpa/showcase/src/test/java/example/springdata/jpa/showcase/before/AccountServiceIntegrationTest.java +++ b/jpa/showcase/src/test/java/example/springdata/jpa/showcase/before/AccountServiceIntegrationTest.java @@ -16,17 +16,16 @@ package example.springdata.jpa.showcase.before; import static org.hamcrest.Matchers.*; -import static org.junit.Assert.*; - -import java.util.List; - -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; import example.springdata.jpa.showcase.AbstractShowcaseTest; import example.springdata.jpa.showcase.core.Account; import example.springdata.jpa.showcase.core.Customer; +import java.util.List; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; + /** * Integration test for {@link AccountService}. * diff --git a/jpa/showcase/src/test/java/example/springdata/jpa/showcase/before/CustomerServiceIntegrationTest.java b/jpa/showcase/src/test/java/example/springdata/jpa/showcase/before/CustomerServiceIntegrationTest.java index ec2b9657..432bfab2 100644 --- a/jpa/showcase/src/test/java/example/springdata/jpa/showcase/before/CustomerServiceIntegrationTest.java +++ b/jpa/showcase/src/test/java/example/springdata/jpa/showcase/before/CustomerServiceIntegrationTest.java @@ -16,16 +16,17 @@ package example.springdata.jpa.showcase.before; import static org.hamcrest.CoreMatchers.*; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.*; -import java.util.List; - -import org.junit.Test; -import org.springframework.beans.factory.annotation.Autowired; - import example.springdata.jpa.showcase.AbstractShowcaseTest; import example.springdata.jpa.showcase.core.Customer; +import java.util.List; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; + /** * Integration test for {@link CustomerService}. * diff --git a/jpa/vavr/src/test/java/example/PersonRepositoryIntegrationTests.java b/jpa/vavr/src/test/java/example/PersonRepositoryIntegrationTests.java index 5c62534f..ca850277 100644 --- a/jpa/vavr/src/test/java/example/PersonRepositoryIntegrationTests.java +++ b/jpa/vavr/src/test/java/example/PersonRepositoryIntegrationTests.java @@ -23,12 +23,12 @@ import io.vavr.control.Try; import javax.persistence.NonUniqueResultException; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.annotation.Transactional; /** @@ -36,7 +36,7 @@ import org.springframework.transaction.annotation.Transactional; * * @author Oliver Gierke */ -@RunWith(SpringRunner.class) +@ExtendWith(SpringExtension.class) @Transactional @SpringBootTest public class PersonRepositoryIntegrationTests {