Migrates JPA examples to JUnit 5.

Original pull request #602
Related tickest #583
This commit is contained in:
divya_jnu08
2021-01-25 20:54:57 +05:30
committed by Jens Schauder
parent 06eed6ec50
commit 6a894d9334
28 changed files with 362 additions and 145 deletions

View File

@@ -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();

View File

@@ -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();