### Question:
MongoDbRegionWidgetRepository implements RegionWidgetRepository { @Override public int getCountAll() { return this.getAll().size(); }  @Override Class<? extends RegionWidget> getType(); @Override RegionWidget get(String id); @Override RegionWidget save(RegionWidget item); @Override void delete(RegionWidget item); @Override List<RegionWidget> getAll(); @Override List<RegionWidget> getLimitedList(int offset, int pageSize); @Override int getCountAll(); void setTemplate(MongoPageOperations template);  }### Answer:
@Test public void getCount(){ String id = "1111L"; String id2 = "2222L"; String regionWidgetId1 = "9876L"; String regionWidgetId2 = "6543L"; String regionWidgetId3 = "2874L"; Page page = new PageImpl("1234L"); List<Page> pages = Lists.newArrayList(); List<Region> regions = Lists.newArrayList(); List<RegionWidget> regionWidgets = Lists.newArrayList(); Region region = new RegionImpl(id); Region region2 = new RegionImpl(id2); RegionWidget rw1 = new RegionWidgetImpl(regionWidgetId1); RegionWidget rw2 = new RegionWidgetImpl(regionWidgetId2); RegionWidget rw3 = new RegionWidgetImpl(regionWidgetId3); regions.add(region); regions.add(region2); regionWidgets.add(rw1); regionWidgets.add(rw2); regionWidgets.add(rw3); region.setRegionWidgets(regionWidgets); pages.add(page); page.setRegions(regions); Query q = new Query(); expect(template.find(q)).andReturn(pages); replay(template); int result = widgetRepository.getCountAll(); assertNotNull(result); assertThat(result, equalTo(3)); }