### Question:
MongoDbRegionRepository implements RegionRepository { @Override public int getCountAll() { return this.getAll().size(); }  @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 getCount(){ 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); int count = repo.getCountAll(); assertNotNull(count); assertThat(count, equalTo(2)); }