### Question:
MongoDbWidgetRepository implements WidgetRepository { @Override public List<Widget> getByStatus(WidgetStatus widgetStatus, int offset, int pageSize) { Query query = new Query(where("widgetStatus").is(getWidgetStatusString(widgetStatus))).skip(offset).limit(pageSize); return template.find(addSort(query)); }  @Override List<Widget> getAll(); @Override List<Widget> getLimitedList(int offset, int pageSize); @Override int getCountAll(); @Override List<Widget> getByFreeTextSearch(String searchTerm, int offset, int pageSize); @Override int getCountFreeTextSearch(String searchTerm); @Override List<Widget> getByStatus(WidgetStatus widgetStatus, int offset, int pageSize); @Override int getCountByStatus(WidgetStatus widgetStatus); @Override List<Widget> getByStatusAndTypeAndFreeTextSearch(WidgetStatus widgetStatus, String type, String searchTerm, int offset, int pageSize); @Override int getCountByStatusAndTypeAndFreeText(WidgetStatus widgetStatus, String type, String searchTerm); @Override List<Widget> getByOwner(User owner, int offset, int pageSize); @Override int getCountByOwner(User owner, int offset, int pageSize); @Override Widget getByUrl(String widgetUrl); @Override WidgetStatistics getWidgetStatistics(String widget_id, String user_id); @Override Map<String, WidgetStatistics> getAllWidgetStatistics(String userId); @Override Map<String, WidgetRating> getUsersWidgetRatings(String userId); @Override List<Widget> getWidgetsByTag(String tagKeyWord, int offset, int pageSize); @Override int getCountByTag(String tagKeyword); @Override int unassignWidgetOwner(String userId); @Override Class<? extends Widget> getType(); @Override Widget get(String id); @Override Widget save(Widget item); @Override void delete(Widget item); @Override WidgetRating getWidgetRatingsByWidgetIdAndUserId(String widgetId, String userId); @Override int deleteAllWidgetRatings(String userId); @Override WidgetRating getRatingById(String widgetId, String id); @Override WidgetRating createWidgetRating(String widgetId, WidgetRating rating); @Override WidgetRating updateWidgetRating(String widgetId, WidgetRating rating); @Override void deleteWidgetRating(String widgetId, WidgetRating item); @Override WidgetTag getTagByWidgetIdAndKeyword(String widgetId, String keyword); @Override WidgetTag getTagById(String id); @Override WidgetTag saveWidgetTag(String widgetId, WidgetTag item); @Override void deleteWidgetTag(WidgetTag item); @Override WidgetComment getCommentById(String widgetId, String id); @Override WidgetComment createWidgetComment(String widgetId, WidgetComment comment); @Override WidgetComment updateWidgetComment(String widgetId, WidgetComment comment); @Override void deleteWidgetComment(String widgetId, WidgetComment comment); @Override int deleteAllWidgetComments(String userId); void setTemplate(MongoWidgetOperations template); void setStatsAggregator(StatisticsAggregator statsAggregator); void setTagTemplate(MongoTagOperations tagTemplate);  }### Answer:
@Test public void getByStatus(){ int offset = 2; int pageSize = 10; List<Widget> widgets = Lists.newArrayList(); Widget w = new WidgetImpl(); w.setWidgetStatus(WidgetStatus.PUBLISHED); Widget w2 = new WidgetImpl(); w2.setWidgetStatus(WidgetStatus.PREVIEW); w.setTitle("A"); w.setDescription("test"); widgets.add(w); widgets.add(w2); expect(template.find(isA(Query.class))).andReturn(widgets); replay(template); List<Widget> result = repo.getByStatus(WidgetStatus.PUBLISHED, offset, pageSize); assertNotNull(result); }