### Question:
DefaultWidgetsResource implements WidgetsResource { @Override public SearchResult<Widget> getWidgets() { SearchResult<org.apache.rave.model.Widget> fromDb = widgetService.getAll(); List<Widget> widget = convert(fromDb.getResultSet()); return new SearchResult<Widget>(widget, fromDb.getTotalResults()); }  @Override SearchResult<Widget> getWidgets(); @Override Widget getWidget(String id); @Override Widget updateWidget(String id, Widget widget); @Override Widget createWidget(Widget widget); @Inject void setWidgetService(WidgetService widgetService);  }### Answer:
@Test public void getAll() { List<Widget> widgets = Lists.newArrayList(w1, w2); SearchResult<Widget> result = new SearchResult<Widget>(widgets, widgets.size()); expect(service.getAll()).andReturn(result); replay(service); SearchResult<org.apache.rave.rest.model.Widget> resourceResult = resource.getWidgets(); assertThat(resourceResult.getTotalResults(), is(equalTo(widgets.size()))); assertThat(resourceResult.getResultSet().get(0).getId(), is(equalTo(w1.getId()))); assertThat(resourceResult.getResultSet().get(1).getId(), is(equalTo(w2.getId()))); }