### Question:
DefaultWidgetsResource implements WidgetsResource { @Override public Widget createWidget(Widget widget) { WidgetImpl toDb = new WidgetImpl(); toDb.setId(widget.getId()); updateProperties(widget, toDb); return new Widget(widgetService.registerNewWidget(toDb)); }  @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 create() { expect(service.registerNewWidget(w1)).andReturn(w1).times(1); replay(service); org.apache.rave.rest.model.Widget widget = resource.createWidget(new org.apache.rave.rest.model.Widget(w1)); validate(widget, w1); }