### Question:
MongoDbPortalPreferenceRepository implements PortalPreferenceRepository { @Override public List<PortalPreference> getLimitedList(int offset, int pageSize) { Query q = new Query().skip(offset).limit(pageSize); return CollectionUtils.<PortalPreference>toBaseTypedList(template.find(q, CLASS, PREFERENCE_COLLECTION)); }  @Override List<PortalPreference> getAll(); @Override List<PortalPreference> getLimitedList(int offset, int pageSize); @Override int getCountAll(); @Override PortalPreference getByKey(String key); @Override Class<? extends PortalPreference> getType(); @Override PortalPreference get(String id); @Override PortalPreference save(PortalPreference item); @Override void delete(PortalPreference item); void setTemplate(MongoOperations template); void setConverter(HydratingConverterFactory converter); static final Class<PortalPreferenceImpl> CLASS; }### Answer:
@Test public void getLimitedList_Valid(){ int offset = 234; int pageSize = 123; List<PortalPreferenceImpl> found = new ArrayList<PortalPreferenceImpl>(); Query q = new Query().skip(offset).limit(pageSize); expect(template.find(q, preferenceRepository.CLASS, CollectionNames.PREFERENCE_COLLECTION)).andReturn(found); replay(template); assertThat(CollectionUtils.<PortalPreference>toBaseTypedList(found), is(sameInstance(preferenceRepository.getLimitedList(offset, pageSize)))); }