|
29 | 29 | import org.junit.jupiter.api.extension.ExtendWith;
|
30 | 30 | import org.springframework.beans.factory.annotation.Autowired;
|
31 | 31 | import org.springframework.dao.InvalidDataAccessApiUsageException;
|
| 32 | +import org.springframework.data.domain.Limit; |
32 | 33 | import org.springframework.data.domain.Page;
|
33 | 34 | import org.springframework.data.domain.PageRequest;
|
34 | 35 | import org.springframework.data.domain.Pageable;
|
| 36 | +import org.springframework.data.domain.ScrollPosition; |
35 | 37 | import org.springframework.data.domain.Slice;
|
36 | 38 | import org.springframework.data.domain.Sort;
|
| 39 | +import org.springframework.data.domain.Window; |
37 | 40 | import org.springframework.data.jpa.domain.sample.Role;
|
38 | 41 | import org.springframework.data.jpa.domain.sample.User;
|
39 | 42 | import org.springframework.data.jpa.provider.PersistenceProvider;
|
|
53 | 56 | * @author Oliver Gierke
|
54 | 57 | * @author Krzysztof Krason
|
55 | 58 | * @author Greg Turnquist
|
| 59 | + * @author Mark Paluch |
56 | 60 | * @see QueryLookupStrategy
|
57 | 61 | */
|
58 | 62 | @ExtendWith(SpringExtension.class)
|
@@ -221,6 +225,23 @@ void executesQueryToSliceWithUnpaged() {
|
221 | 225 | assertThat(slice.hasNext()).isFalse();
|
222 | 226 | }
|
223 | 227 |
|
| 228 | + @Test // DATAJPA-94 |
| 229 | + void executesQueryWithLimitAndScrollPosition() { |
| 230 | + |
| 231 | + Window<User> first = userRepository.findByLastnameOrderByFirstname(Limit.of(1), // |
| 232 | + ScrollPosition.offset(), // |
| 233 | + "Matthews" // |
| 234 | + ); |
| 235 | + |
| 236 | + Window<User> next = userRepository.findByLastnameOrderByFirstname(Limit.of(1), // |
| 237 | + ScrollPosition.offset(1), // |
| 238 | + "Matthews" // |
| 239 | + ); |
| 240 | + |
| 241 | + assertThat(first).containsExactly(dave); |
| 242 | + assertThat(next).containsExactly(oliver); |
| 243 | + } |
| 244 | + |
224 | 245 | @Test // DATAJPA-830
|
225 | 246 | void executesMethodWithNotContainingOnStringCorrectly() {
|
226 | 247 |
|
|
0 commit comments