### Question:
DefaultRegionService implements RegionService { @Override public SearchResult<Region> getLimitedList(int offset, int pageSize) { final int count = regionRepository.getCountAll(); final List<Region> regions = regionRepository.getLimitedList(offset, pageSize); final SearchResult<Region> searchResult = new SearchResult<Region>(regions, count); searchResult.setOffset(offset); searchResult.setPageSize(pageSize); return searchResult; } @Autowired  DefaultRegionService(RegionRepository regionRepository); @Override @Transactional void registerNewRegion(Region region); @Override SearchResult<Region> getAll(); @Override SearchResult<Region> getLimitedList(int offset, int pageSize);  }### Answer:
@Test public void getLimitedList() { Page page = new PageImpl("1", "3"); Region region1 = new RegionImpl("4", page, 0); Region region2 = new RegionImpl("5", page, 1); List<Region> regions = new ArrayList<Region>(); regions.add(region1); regions.add(region2); final int pageSize = 10; expect(regionRepository.getCountAll()).andReturn(2); expect(regionRepository.getLimitedList(0, pageSize)).andReturn(regions); replay(regionRepository); SearchResult<Region> result = regionService.getLimitedList(0, pageSize); assertEquals(pageSize, result.getPageSize()); assertSame(regions, result.getResultSet()); verify(regionRepository); }