|
15 | 15 | */
|
16 | 16 | package org.springframework.data.envers.repository.support;
|
17 | 17 |
|
| 18 | +import static org.assertj.core.api.Assertions.*; |
| 19 | +import static org.springframework.data.history.RevisionMetadata.RevisionType.*; |
| 20 | + |
| 21 | +import java.time.Instant; |
| 22 | +import java.util.Arrays; |
| 23 | +import java.util.HashSet; |
| 24 | +import java.util.Iterator; |
| 25 | +import java.util.Optional; |
| 26 | + |
18 | 27 | import org.junit.jupiter.api.BeforeEach;
|
19 | 28 | import org.junit.jupiter.api.Test;
|
20 | 29 | import org.junit.jupiter.api.extension.ExtendWith;
|
| 30 | + |
21 | 31 | import org.springframework.beans.factory.annotation.Autowired;
|
22 | 32 | import org.springframework.data.domain.Page;
|
23 | 33 | import org.springframework.data.domain.PageRequest;
|
| 34 | +import org.springframework.data.domain.Pageable; |
24 | 35 | import org.springframework.data.domain.Sort;
|
25 | 36 | import org.springframework.data.envers.Config;
|
26 | 37 | import org.springframework.data.envers.sample.Country;
|
|
33 | 44 | import org.springframework.test.context.ContextConfiguration;
|
34 | 45 | import org.springframework.test.context.junit.jupiter.SpringExtension;
|
35 | 46 |
|
36 |
| -import java.time.Instant; |
37 |
| -import java.util.Arrays; |
38 |
| -import java.util.HashSet; |
39 |
| -import java.util.Iterator; |
40 |
| -import java.util.Optional; |
41 |
| - |
42 |
| -import static org.assertj.core.api.Assertions.*; |
43 |
| -import static org.springframework.data.history.RevisionMetadata.RevisionType.*; |
44 |
| - |
45 | 47 | /**
|
46 | 48 | * Integration tests for repositories.
|
47 | 49 | *
|
48 | 50 | * @author Oliver Gierke
|
49 | 51 | * @author Jens Schauder
|
50 | 52 | * @author Niklas Loechte
|
| 53 | + * @author Mark Paluch |
51 | 54 | */
|
52 | 55 | @ExtendWith(SpringExtension.class)
|
53 | 56 | @ContextConfiguration(classes = Config.class)
|
@@ -107,6 +110,40 @@ void testLifeCycle() {
|
107 | 110 | });
|
108 | 111 | }
|
109 | 112 |
|
| 113 | + @Test // GH-3999 |
| 114 | + void shouldReturnUnpagedResults() { |
| 115 | + |
| 116 | + License license = new License(); |
| 117 | + license.name = "Schnitzel"; |
| 118 | + |
| 119 | + licenseRepository.save(license); |
| 120 | + |
| 121 | + Country de = new Country(); |
| 122 | + de.code = "de"; |
| 123 | + de.name = "Deutschland"; |
| 124 | + |
| 125 | + countryRepository.save(de); |
| 126 | + |
| 127 | + Country se = new Country(); |
| 128 | + se.code = "se"; |
| 129 | + se.name = "Schweden"; |
| 130 | + |
| 131 | + countryRepository.save(se); |
| 132 | + |
| 133 | + license.laender = new HashSet<>(); |
| 134 | + license.laender.addAll(Arrays.asList(de, se)); |
| 135 | + |
| 136 | + licenseRepository.save(license); |
| 137 | + |
| 138 | + de.name = "Daenemark"; |
| 139 | + |
| 140 | + countryRepository.save(de); |
| 141 | + |
| 142 | + Page<Revision<Integer, License>> revisions = licenseRepository.findRevisions(license.id, Pageable.unpaged()); |
| 143 | + |
| 144 | + assertThat(revisions).hasSize(2); |
| 145 | + } |
| 146 | + |
110 | 147 | @Test // #1
|
111 | 148 | void returnsEmptyLastRevisionForUnrevisionedEntity() {
|
112 | 149 | assertThat(countryRepository.findLastChangeRevision(100L)).isEmpty();
|
|
0 commit comments