committed by
Jens Schauder
parent
d580ad4962
commit
7a1eba19d8
@@ -23,7 +23,7 @@ import java.time.ZoneOffset;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
|
||||
import org.hibernate.envers.DefaultRevisionEntity;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link DefaultRevisionMetadata}.
|
||||
@@ -32,12 +32,12 @@ import org.junit.Test;
|
||||
* @author Jens Schauder
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class DefaultRevisionMetadataUnitTests {
|
||||
class DefaultRevisionMetadataUnitTests {
|
||||
|
||||
private static final Instant NOW = Instant.now();;
|
||||
|
||||
@Test // #112
|
||||
public void createsLocalDateTimeFromTimestamp() {
|
||||
void createsLocalDateTimeFromTimestamp() {
|
||||
|
||||
DefaultRevisionEntity entity = new DefaultRevisionEntity();
|
||||
entity.setTimestamp(NOW.toEpochMilli());
|
||||
|
||||
@@ -20,7 +20,7 @@ import static org.mockito.Mockito.*;
|
||||
|
||||
import org.hibernate.envers.DefaultRevisionEntity;
|
||||
import org.hibernate.envers.RevisionType;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.data.history.AnnotationRevisionMetadata;
|
||||
import org.springframework.data.history.RevisionMetadata;
|
||||
|
||||
@@ -29,10 +29,10 @@ import org.springframework.data.history.RevisionMetadata;
|
||||
*
|
||||
* @author Jens Schauder
|
||||
*/
|
||||
public class EnversRevisionRepositoryImplUnitTests {
|
||||
class EnversRevisionRepositoryImplUnitTests {
|
||||
|
||||
@Test // gh-215
|
||||
public void revisionTypeOfAnnotationRevisionMetadataIsProperlySet() {
|
||||
void revisionTypeOfAnnotationRevisionMetadataIsProperlySet() {
|
||||
|
||||
Object[] data = new Object[] { "a", "some metadata", RevisionType.DEL };
|
||||
|
||||
@@ -45,7 +45,7 @@ public class EnversRevisionRepositoryImplUnitTests {
|
||||
}
|
||||
|
||||
@Test // gh-215
|
||||
public void revisionTypeOfDefaultRevisionMetadataIsProperlySet() {
|
||||
void revisionTypeOfDefaultRevisionMetadataIsProperlySet() {
|
||||
|
||||
Object[] data = new Object[] { "a", mock(DefaultRevisionEntity.class), RevisionType.DEL };
|
||||
|
||||
|
||||
@@ -19,9 +19,10 @@ import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
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.data.envers.Config;
|
||||
import org.springframework.data.envers.sample.Country;
|
||||
@@ -30,7 +31,7 @@ import org.springframework.data.envers.sample.QCountry;
|
||||
import org.springframework.data.history.Revision;
|
||||
import org.springframework.data.history.Revisions;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
/**
|
||||
* Integration tests for repositories with Querydsl support. They make sure that methods provided by both
|
||||
@@ -39,20 +40,20 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
* @author Dmytro Iaroslavskyi
|
||||
* @author Jens Schauder
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@ContextConfiguration(classes = Config.class)
|
||||
public class QueryDslRepositoryIntegrationTests {
|
||||
class QueryDslRepositoryIntegrationTests {
|
||||
|
||||
@Autowired
|
||||
CountryQueryDslRepository countryRepository;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
countryRepository.deleteAll();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithQueryDsl() {
|
||||
void testWithQueryDsl() {
|
||||
|
||||
Country de = new Country();
|
||||
de.code = "de";
|
||||
@@ -67,7 +68,7 @@ public class QueryDslRepositoryIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWithRevisions() {
|
||||
void testWithRevisions() {
|
||||
|
||||
Country de = new Country();
|
||||
de.code = "de";
|
||||
|
||||
@@ -23,10 +23,11 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
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.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
@@ -39,7 +40,7 @@ import org.springframework.data.history.Revision;
|
||||
import org.springframework.data.history.RevisionSort;
|
||||
import org.springframework.data.history.Revisions;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.junit.jupiter.SpringExtension;
|
||||
|
||||
/**
|
||||
* Integration tests for repositories.
|
||||
@@ -47,31 +48,31 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
* @author Oliver Gierke
|
||||
* @author Jens Schauder
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ExtendWith(SpringExtension.class)
|
||||
@ContextConfiguration(classes = Config.class)
|
||||
public class RepositoryIntegrationTests {
|
||||
class RepositoryIntegrationTests {
|
||||
|
||||
@Autowired
|
||||
LicenseRepository licenseRepository;
|
||||
@Autowired
|
||||
CountryRepository countryRepository;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
|
||||
licenseRepository.deleteAll();
|
||||
countryRepository.deleteAll();
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
@AfterEach
|
||||
void tearDown() {
|
||||
|
||||
licenseRepository.deleteAll();
|
||||
countryRepository.deleteAll();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLifeCycle() {
|
||||
void testLifeCycle() {
|
||||
|
||||
License license = new License();
|
||||
license.name = "Schnitzel";
|
||||
@@ -110,22 +111,22 @@ public class RepositoryIntegrationTests {
|
||||
}
|
||||
|
||||
@Test // #1
|
||||
public void returnsEmptyLastRevisionForUnrevisionedEntity() {
|
||||
void returnsEmptyLastRevisionForUnrevisionedEntity() {
|
||||
assertThat(countryRepository.findLastChangeRevision(100L)).isEmpty();
|
||||
}
|
||||
|
||||
@Test // #47
|
||||
public void returnsEmptyRevisionsForUnrevisionedEntity() {
|
||||
void returnsEmptyRevisionsForUnrevisionedEntity() {
|
||||
assertThat(countryRepository.findRevisions(100L)).isEmpty();
|
||||
}
|
||||
|
||||
@Test // #47
|
||||
public void returnsEmptyRevisionForUnrevisionedEntity() {
|
||||
void returnsEmptyRevisionForUnrevisionedEntity() {
|
||||
assertThat(countryRepository.findRevision(100L, 23)).isEmpty();
|
||||
}
|
||||
|
||||
@Test // #31
|
||||
public void returnsParticularRevisionForAnEntity() {
|
||||
void returnsParticularRevisionForAnEntity() {
|
||||
|
||||
Country de = new Country();
|
||||
de.code = "de";
|
||||
@@ -153,7 +154,7 @@ public class RepositoryIntegrationTests {
|
||||
}
|
||||
|
||||
@Test // #55
|
||||
public void considersRevisionNumberSortOrder() {
|
||||
void considersRevisionNumberSortOrder() {
|
||||
|
||||
Country de = new Country();
|
||||
de.code = "de";
|
||||
@@ -174,7 +175,7 @@ public class RepositoryIntegrationTests {
|
||||
}
|
||||
|
||||
@Test // #21
|
||||
public void findsDeletedRevisions() {
|
||||
void findsDeletedRevisions() {
|
||||
|
||||
Country de = new Country();
|
||||
de.code = "de";
|
||||
@@ -194,7 +195,7 @@ public class RepositoryIntegrationTests {
|
||||
}
|
||||
|
||||
@Test // #47
|
||||
public void includesCorrectRevisionType() {
|
||||
void includesCorrectRevisionType() {
|
||||
|
||||
Country de = new Country();
|
||||
de.code = "de";
|
||||
@@ -220,7 +221,7 @@ public class RepositoryIntegrationTests {
|
||||
}
|
||||
|
||||
@Test // #146
|
||||
public void shortCircuitingWhenOffsetIsToLarge() {
|
||||
void shortCircuitingWhenOffsetIsToLarge() {
|
||||
|
||||
Country de = new Country();
|
||||
de.code = "de";
|
||||
@@ -236,7 +237,7 @@ public class RepositoryIntegrationTests {
|
||||
}
|
||||
|
||||
@Test // #47
|
||||
public void paginationWithEmptyResult() {
|
||||
void paginationWithEmptyResult() {
|
||||
|
||||
check(23L, 0, 0, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user