### Question:
MongoDbUserRepository implements UserRepository { @Override public List<User> getLimitedList(int offset, int pageSize) { Query query = new Query().skip(offset).limit(pageSize); return template.find(addSort(query)); }  @Override User getByUsername(String username); @Override User getByUserEmail(String userEmail); @Override User getByOpenId(String openId); @Override List<User> getAll(); @Override List<User> getLimitedList(int offset, int pageSize); @Override int getCountAll(); @Override List<User> findByUsernameOrEmail(String searchTerm, int offset, int pageSize); @Override int getCountByUsernameOrEmail(String searchTerm); @Override List<User> getAllByAddedWidget(String  widgetId); @Override User getByForgotPasswordHash(String hash); @Override Class<? extends User> getType(); @Override User get(String  id); @Override User save(User item); @Override void delete(User item); void setTemplate(MongoUserOperations template); void setStatisticsAggregator(StatisticsAggregator statisticsAggregator);  }### Answer:
@Test public void getLimitedList_Valid(){ int offset = 234; int pageSize = 123; List<User> found = new ArrayList<User>(); expect(template.find(isA(Query.class))).andReturn(found); replay(template); assertThat(found, is(sameInstance(userRepository.getLimitedList(offset, pageSize)))); }