### Question:
MongoDbWidgetConverter implements HydratingModelConverter<Widget, MongoDbWidget> { @Override public void hydrate(MongoDbWidget dehydrated) { if(dehydrated == null) { return; } dehydrated.setCategoryRepository(categoryRepository); }  @Override Class<Widget> getSourceType(); @Override void hydrate(MongoDbWidget dehydrated); @Override MongoDbWidget convert(Widget source); void setCategoryRepository(CategoryRepository categoryRepository);  }### Answer:
@Test public void hydrate_valid() { MongoDbWidget dehydrated = new MongoDbWidget(); dehydrated.setComments(Lists.<WidgetComment>newLinkedList()); WidgetCommentImpl wc = new WidgetCommentImpl(); dehydrated.getComments().add(wc); dehydrated.setTags(Lists.<WidgetTag>newLinkedList()); WidgetTagImpl wt = new WidgetTagImpl(); dehydrated.getTags().add(wt); converter.hydrate(dehydrated); assertThat(dehydrated.getCategoryRepository(), is(sameInstance(categoryRepository))); }
@Test public void hydrate_Tags_Null_Comments_Null() { MongoDbWidget dehydrated = new MongoDbWidget(); converter.hydrate(dehydrated); assertThat(dehydrated.getCategoryRepository(), is(sameInstance(categoryRepository))); }
@Test public void hydrate_null() { converter.hydrate(null); assertThat(true, is(true)); }
@Test public void hydrate_NotMongoWidget_NotMongoComments() { WidgetTag widgetTag = new WidgetTagImpl(); WidgetComment widgetComment = new WidgetCommentImpl(); MongoDbWidget widget = new MongoDbWidget(); widget.setComments(Arrays.asList(widgetComment)); widget.setTags(Arrays.asList(widgetTag)); converter.hydrate(widget); assertTrue(widgetTag instanceof WidgetTagImpl); assertTrue(widgetComment instanceof WidgetCommentImpl); }