Skip to content

Commit 592ebc9

Browse files
committed
Add test case for repository methods that accept a Pageable
1 parent 92a18cd commit 592ebc9

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/test/java/org/springframework/data/ebean/repository/UserRepositoryIntegrationTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,4 +468,11 @@ public void testDomainEvent() {
468468
assertNotNull(u);
469469
assertEquals("yuanxuegui@126.com", u.getEmailAddress());
470470
}
471+
472+
@Test
473+
public void findUserByEmailAddressEqualsOql_pageable() {
474+
Page<User> page = userRepository.findUserByEmailAddressEqualsOql("yuanxuegui@163.com", PageRequest.of(0, 20, Sort.Direction.DESC, "id"));
475+
assertNotNull(page);
476+
}
477+
471478
}

src/test/java/org/springframework/data/ebean/sample/domain/UserRepository.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package org.springframework.data.ebean.sample.domain;
22

33
import java.util.List;
4+
5+
import org.springframework.data.domain.Page;
6+
import org.springframework.data.domain.Pageable;
47
import org.springframework.data.ebean.annotation.Modifying;
58
import org.springframework.data.ebean.annotation.Query;
69
import org.springframework.data.ebean.repository.EbeanRepository;
@@ -40,4 +43,8 @@ public interface UserRepository extends EbeanRepository<User, Long> {
4043
List<User> findByLastNameNamedOql(@Param("lastName") String lastName);
4144

4245
List<User> findAllByEmailAddressAndFullNameLastName(@Param("emailAddress") String emailAddress, @Param("lastName") String lastName);
46+
47+
@Query( value = "where emailAddress = :emailAddress")
48+
Page<User> findUserByEmailAddressEqualsOql(@Param("emailAddress") String lastName, Pageable page);
49+
4350
}

0 commit comments

Comments
 (0)