### Question:
PaginatingPersonRepositoryImpl implements PaginatingPersonRepository { @Override public List<Person> findPersonsForPage(String searchTerm, int page) { LOGGER.debug("Finding persons for page " + page + " with search term: " + searchTerm); Page requestedPage = personRepository.findAll(lastNameIsLike(searchTerm), constructPageSpecification(page)); return requestedPage.getContent(); } PaginatingPersonRepositoryImpl(); @Override List<Person> findAllPersons(); @Override long findPersonCount(String searchTerm); @Override List<Person> findPersonsForPage(String searchTerm, int page); @PostConstruct void init();  }### Answer:
@Test public void findPersonsForPage() { List<Person> expected = new ArrayList<Person>(); Page foundPage = new PageImpl<Person>(expected); when(personRepositoryMock.findAll(any(Predicate.class), any(Pageable.class))).thenReturn(foundPage); List<Person> actual = repository.findPersonsForPage(SEARCH_TERM, PAGE_INDEX); ArgumentCaptor<Pageable> pageSpecificationArgument = ArgumentCaptor.forClass(Pageable.class); verify(personRepositoryMock, times(1)).findAll(any(Predicate.class), pageSpecificationArgument.capture()); verifyNoMoreInteractions(personRepositoryMock); Pageable pageSpecification = pageSpecificationArgument.getValue(); assertEquals(PAGE_INDEX, pageSpecification.getPageNumber()); assertEquals(PaginatingPersonRepositoryImpl.NUMBER_OF_PERSONS_PER_PAGE, pageSpecification.getPageSize()); assertEquals(Sort.Direction.ASC, pageSpecification.getSort().getOrderFor(PROPERTY_LASTNAME).getDirection()); assertEquals(expected, actual); }