### Question:
DefaultRegionWidgetService implements RegionWidgetService { @Override public SearchResult<RegionWidget> getLimitedList(int offset, int pageSize) { final int count = regionWidgetRepository.getCountAll(); final List<RegionWidget> regionWidgets = regionWidgetRepository.getLimitedList(offset, pageSize); final SearchResult<RegionWidget> searchResult = new SearchResult<RegionWidget>(regionWidgets, count); searchResult.setOffset(offset); searchResult.setPageSize(pageSize); return searchResult; } @Autowired  DefaultRegionWidgetService(RegionWidgetRepository regionWidgetRepository); @Override RegionWidget getRegionWidget(String regionWidgetId); @Override SearchResult<RegionWidget> getAll(); @Override SearchResult<RegionWidget> getLimitedList(int offset, int pageSize); @Override @Transactional RegionWidget saveRegionWidget(RegionWidget regionWidget); @Override @Synchronized(discriminator = "'RegionWidget'", id = "#regionWidgetId") @Transactional List<RegionWidgetPreference> saveRegionWidgetPreferences(String regionWidgetId,
                                                                    List<RegionWidgetPreference> preferences); @Override @Synchronized(discriminator = "'RegionWidget'", id = "#regionWidgetId") @Transactional RegionWidgetPreference saveRegionWidgetPreference(String regionWidgetId, RegionWidgetPreference preference); @Override @Transactional RegionWidget saveRegionWidgetCollapsedState(String regionWidgetId, boolean collapsed);  }### Answer:
@Test public void getLimitedList() { Page page = new PageImpl("1", "3"); Region region = new RegionImpl("4", page, 0); RegionWidget rw1 = new RegionWidgetImpl("1", "4", region); RegionWidget rw2 = new RegionWidgetImpl("2", "7", region); List<RegionWidget> regionWidgets = new ArrayList<RegionWidget>(); regionWidgets.add(rw1); regionWidgets.add(rw2); final int pageSize = 10; expect(regionWidgetRepository.getCountAll()).andReturn(2); expect(regionWidgetRepository.getLimitedList(0, pageSize)).andReturn(regionWidgets); replay(regionWidgetRepository); SearchResult<RegionWidget> result = regionWidgetService.getLimitedList(0, pageSize); assertEquals(pageSize, result.getPageSize()); assertSame(regionWidgets, result.getResultSet()); verify(regionWidgetRepository); }