### Question:
MongoDbRegionRepository implements RegionRepository { @Override public List<Region> getAll(){ Query q = new Query(); List<Page> allPages = template.find(q); List<Region> regions = new ArrayList<Region>(); for(Page page: allPages){ List<Region> rgns = page.getRegions(); if(rgns != null){ for(Region region : rgns) { regions.add(region); } } } return regions; }  @Override Class<? extends Region> getType(); @Override Region get(String  id); @Override Region save(Region item); @Override void delete(Region item); @Override List<Region> getAll(); @Override List<Region> getLimitedList(int offset, int pageSize); @Override int getCountAll(); MongoPageOperations getTemplate(); void setTemplate(MongoPageOperations template);  }### Answer:
@Test public void getAll(){ String id = "1111L"; String id2 = "2222L"; Page page = new PageImpl("1234L"); List<Page> pages = Lists.newArrayList(); List<Region> regions = Lists.newArrayList(); Region region = new RegionImpl(id); Region region2 = new RegionImpl(id2); regions.add(region); regions.add(region2); pages.add(page); page.setRegions(regions); Query q = new Query(); expect(template.find(q)).andReturn(pages); replay(template); List<Region> result = repo.getAll(); assertNotNull(result); assertThat(result, is(equalTo(regions))); assertThat(result.size(), equalTo(2)); }