Skip to content

Commit ede8ced

Browse files
committed
test: add unit test for new constructor
#3296 Signed-off-by: Attacktive <[email protected]>
1 parent 84f2fce commit ede8ced

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/test/java/org/springframework/data/domain/PageImplUnitTests.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,22 @@
3232
*/
3333
class PageImplUnitTests {
3434

35+
@Test
36+
void createsPageWithContentAndPageable() {
37+
38+
List<String> content = Arrays.asList("foo", "bar", "baz");
39+
PageRequest pageable = PageRequest.of(1, 10);
40+
41+
Page<String> page = new PageImpl<>(content, pageable);
42+
43+
assertThat(page.getContent()).isEqualTo(content);
44+
assertThat(page.getPageable()).isEqualTo(pageable);
45+
assertThat(page.getTotalElements()).isEqualTo(content.size());
46+
assertThat(page.getTotalPages()).isEqualTo(1);
47+
assertThat(page.getNumber()).isEqualTo(1);
48+
assertThat(page.getSize()).isEqualTo(10);
49+
}
50+
3551
@Test
3652
void assertEqualsForSimpleSetup() {
3753

0 commit comments

Comments
 (0)