|
15 | 15 | package org.eclipse.jnosql.databases.arangodb.integration; |
16 | 16 |
|
17 | 17 |
|
| 18 | +import jakarta.data.page.CursoredPage; |
| 19 | +import jakarta.data.page.PageRequest; |
18 | 20 | import jakarta.inject.Inject; |
19 | 21 | import org.assertj.core.api.SoftAssertions; |
| 22 | +import org.eclipse.jnosql.communication.semistructured.SelectQuery; |
20 | 23 | import org.eclipse.jnosql.databases.arangodb.communication.ArangoDBConfigurations; |
21 | 24 | import org.eclipse.jnosql.databases.arangodb.mapping.ArangoDBTemplate; |
22 | 25 | import org.eclipse.jnosql.mapping.Database; |
@@ -198,4 +201,23 @@ void shouldExecuteLimitStart() { |
198 | 201 | soft.assertThat(editions).hasSize(3).contains(5, 6, 7); |
199 | 202 | }); |
200 | 203 | } |
| 204 | + |
| 205 | + @Test |
| 206 | + void shouldSelectCursorSize() { |
| 207 | + for (int index = 1; index < 10; index++) { |
| 208 | + var book = new Book(randomUUID().toString(), "Effective Java", index); |
| 209 | + template.insert(book); |
| 210 | + } |
| 211 | + var select = SelectQuery.select().from("Book").orderBy("edition").asc() |
| 212 | + .skip(4).limit(3).build(); |
| 213 | + var pageRequest = PageRequest.ofSize(3); |
| 214 | + CursoredPage<Book> entities = template.selectCursor(select, pageRequest); |
| 215 | + |
| 216 | + SoftAssertions.assertSoftly(soft -> { |
| 217 | + var content = entities.content(); |
| 218 | + soft.assertThat(content).hasSize(3); |
| 219 | + var editions = content.stream().map(Book::edition).toList(); |
| 220 | + soft.assertThat(editions).hasSize(3).contains(1, 2, 3); |
| 221 | + }); |
| 222 | + } |
201 | 223 | } |
0 commit comments