@Test
public void testPaginationFull() {

  final int usersTotal = 13;
  final int pageLen = 6;
  final int pageIndex = 1;
  this.fillUsers(usersTotal);
  final MultivaluedHashMap<String, String> paginationParams = new MultivaluedHashMap<>();
  paginationParams.add("page[number]", "" + pageIndex);
  paginationParams.add("page[size]", "" + pageLen);
  final Query<User> paginationQuery = Query.fromParameterMap(paginationParams);
  final xyz.morphia.query.Query<User> q = Mockito.mock(xyz.morphia.query.Query.class);
  Mockito.when(this.store.createQuery(User.class)).thenReturn(q);
  Mockito.doAnswer(new Answer<List<User>>() {
    @Override
    public List<User> answer(final InvocationOnMock invocation) throws Throwable {
      final FindOptions options = invocation.getArgument(0, FindOptions.class);
      final int skip = options.getSkip();
      final int limit = options.getLimit();
      final List<User> r =
          new ArrayList<>(UserServiceTest.this.users.subList(skip, skip + limit));
      return r;
    }
  }).when(q).asList(ArgumentMatchers.any(FindOptions.class));
  final QueryResult<User> returned = this.userService.query(paginationQuery);
  Assert.assertEquals(pageLen, returned.getN());
}