-
Notifications
You must be signed in to change notification settings - Fork 701
Closed
Labels
type: documentationA documentation updateA documentation update
Milestone
Description
I have used PageableExecutionUtils for the first time today and think there might be a bug. The returned page seems to always contain the whole content, not a sublist of the given input as I would expect. Or is there a misunderstanding on my side that I am not seeing?
The following simple test illustrates the issue:
@Test
void testPageContent() {
List<Integer> content = List.of(1, 2, 3, 4, 5, 6, 7, 8, 9);
Page<Integer> page = PageableExecutionUtils.getPage(content, PageRequest.of(1, 4), content::size);
assertThat(page.getTotalElements()).isEqualTo(9);
assertThat(page.getTotalPages()).isEqualTo(3);
assertThat(page.getNumber()).isEqualTo(1);
assertThat(page.getSize()).isEqualTo(4);
assertThat(page.getNumberOfElements()).isEqualTo(4); //fails
assertThat(page.getContent().size()).isEqualTo(4); //fails
assertThat(page).containsExactly(5, 6, 7, 8); //fails
}
Cheers
Stefan
Metadata
Metadata
Assignees
Labels
type: documentationA documentation updateA documentation update