diff --git a/src/main/java/org/springframework/data/redis/core/RedisQueryEngine.java b/src/main/java/org/springframework/data/redis/core/RedisQueryEngine.java index 60f4e7b79..a4e9c6c86 100644 --- a/src/main/java/org/springframework/data/redis/core/RedisQueryEngine.java +++ b/src/main/java/org/springframework/data/redis/core/RedisQueryEngine.java @@ -40,6 +40,7 @@ import org.springframework.util.CollectionUtils; * Redis specific {@link QueryEngine} implementation. * * @author Christoph Strobl + * @author Mark Paluch * @since 1.7 */ class RedisQueryEngine extends QueryEngine> { @@ -156,6 +157,10 @@ class RedisQueryEngine extends QueryEngine() { @Override diff --git a/src/test/java/org/springframework/data/redis/repository/RedisRepositoryIntegrationTestBase.java b/src/test/java/org/springframework/data/redis/repository/RedisRepositoryIntegrationTestBase.java index e21ad5210..9cbcaf138 100644 --- a/src/test/java/org/springframework/data/redis/repository/RedisRepositoryIntegrationTestBase.java +++ b/src/test/java/org/springframework/data/redis/repository/RedisRepositoryIntegrationTestBase.java @@ -203,8 +203,26 @@ public abstract class RedisRepositoryIntegrationTestBase { repo.save(Arrays.asList(eddard, robb, jon)); Page firstPage = repo.findAll(new PageRequest(0, 2)); - assertThat(firstPage.getContent(), hasSize(2)); - assertThat(repo.findAll(firstPage.nextPageable()).getContent(), hasSize(1)); + assertThat(firstPage.getContent(), hasSize(2)); + assertThat(repo.findAll(firstPage.nextPageable()).getContent(), hasSize(1)); + } + + /** + * @see DATAREDIS-551 + */ + @Test + public void shouldApplyPageableCorrectlyWhenUsingFindByWithoutCriteria() { + + Person eddard = new Person("eddard", "stark"); + Person robb = new Person("robb", "stark"); + Person jon = new Person("jon", "snow"); + + repo.save(Arrays.asList(eddard, robb, jon)); + + Page firstPage = repo.findBy(new PageRequest(0, 2)); + assertThat(firstPage.getContent(), hasSize(2)); + assertThat(firstPage.getTotalElements(), is(equalTo(3L))); + assertThat(repo.findBy(firstPage.nextPageable()).getContent(), hasSize(1)); } /** @@ -280,6 +298,8 @@ public abstract class RedisRepositoryIntegrationTestBase { List findByFirstnameOrLastname(String firstname, String lastname); List findBy(); + + Page findBy(Pageable page); } /**