JpaCustomerDao extends JpaAbstractSearchTextDao<CustomerEntity, Customer> implements CustomerDao { @Override public List<Customer> findCustomersByTenantId(UUID tenantId, TextPageLink pageLink) { return DaoUtil.convertDataList(customerRepository.findByTenantId( UUIDConverter.fromTimeUUID(tenantId), Objects.toString(pageLink.getTextSearch(), ""), pageLink.getIdOffset() == null ? NULL_UUID_STR : UUIDConverter.fromTimeUUID(pageLink.getIdOffset()), new PageRequest(0, pageLink.getLimit()))); }  @Override List<Customer> findCustomersByTenantId(UUID tenantId, TextPageLink pageLink); @Override Optional<Customer> findCustomersByTenantIdAndTitle(UUID tenantId, String title);  }
@Test public void testFindByTenantId() { UUID tenantId1 = UUIDs.timeBased(); UUID tenantId2 = UUIDs.timeBased(); for (int i = 0; i < 20; i++) { createCustomer(tenantId1, i); createCustomer(tenantId2, i * 2); } TextPageLink pageLink1 = new TextPageLink(15, "CUSTOMER"); List<Customer> customers1 = customerDao.findCustomersByTenantId(tenantId1, pageLink1); assertEquals(15, customers1.size()); TextPageLink pageLink2 = new TextPageLink(15, "CUSTOMER", customers1.get(14).getId().getId(), null); List<Customer> customers2 = customerDao.findCustomersByTenantId(tenantId1, pageLink2); assertEquals(5, customers2.size()); }