### Question:
MongoDbGroupConverter implements HydratingModelConverter<Group, MongoDbGroup> { @Override public MongoDbGroup convert(Group source) { MongoDbGroup group = new MongoDbGroup(); group.setId(source.getId() == null ? generateId() : source.getId()); group.setTitle(source.getTitle()); group.setOwnerId(source.getOwnerId()); group.setDescription(source.getDescription()); group.setMemberIds(source.getMemberIds()); return group; }  @Override void hydrate(MongoDbGroup dehydrated); @Override Class<Group> getSourceType(); @Override MongoDbGroup convert(Group source);  }### Answer:
@Test public void convert_valid(){ Group group = new GroupImpl(); group.setId(USER1ID); group.setTitle("asdf"); group.setDescription("Description"); group.setMemberIds(Arrays.asList(new String[] {"1", "2", "3"})); group.setOwnerId(USER2ID); MongoDbGroup mongoGroup = converter.convert(group); assertThat(mongoGroup.getId(), is(equalTo(USER1ID))); assertThat(mongoGroup.getTitle(), is(equalTo("asdf"))); assertThat(mongoGroup.getDescription(), is("Description")); assertThat(mongoGroup.getMemberIds().size(), is(3)); assertThat(mongoGroup.getOwnerId(), is(USER2ID)); }
@Test public void convert_Null(){ Group source = new GroupImpl(); MongoDbGroup converted = converter.convert(source); assertNull(converted.getTitle()); assertNull(converted.getDescription()); assertNotNull(converted.getId()); }