Consider the following repository:
JUnit test with correct counts but empty content:Code:public interface ActivityRepository extends PagingAndSortingRepository<Activity, String> { public Page<Activity> findByCreatedBy(String systemUserId, Pageable pageable); }
Output:Code:Page<Activity> activities = activityRepository.findByCreatedBy("123_some_id", new PageRequest(1, 1000)); assertEquals("totalElements", activities.getTotalElements(), 2); assertEquals("totalPages", activities.getTotalPages(), 1); System.out.println("1: " + activities.getTotalElements()); System.out.println("2: " + activities.getTotalPages()); System.out.println("3: " + activities); System.out.println("4: " + activities.getContent());
So it seem like the counts are calculated correctly by the content is not added to the Page-object?Code:1: 2 2: 1 3: Page 1 of 1 containing UNKNOWN instances 4: []
I'm using Spring 3.1.1.RELEASE and spring-data-mongodb 1.0.1.RELEASE.


Reply With Quote
