### Question:
MongoDbAuthorityConverter implements HydratingModelConverter<Authority, MongoDbAuthority> { @Override public MongoDbAuthority convert(Authority source) { MongoDbAuthority converted = source instanceof MongoDbAuthority ? (MongoDbAuthority) source : new MongoDbAuthority(); converted.setAuthority(source.getAuthority()); converted.setDefaultForNewUser(source.isDefaultForNewUser()); return converted; }  @Override void hydrate(MongoDbAuthority dehydrated); @Override Class<Authority> getSourceType(); @Override MongoDbAuthority convert(Authority source);  }### Answer:
@Test public void convert_Valid(){ Authority authority = new AuthorityImpl(); authority.setAuthority("asd;lkfjlkj"); authority.setDefaultForNewUser(true); MongoDbAuthority converted = authorityConverter.convert(authority); assertNotNull(converted.getAuthority()); assertThat(converted.getAuthority(), is(sameInstance(authority.getAuthority()))); assertThat(converted.isDefaultForNewUser(), is(sameInstance(authority.isDefaultForNewUser()))); Authority authorityMongo = new MongoDbAuthority(); authorityMongo.setAuthority("authority"); authorityMongo.setDefaultForNewUser(true); MongoDbAuthority mongoConverted = authorityConverter.convert(authorityMongo); assertThat(mongoConverted, is(sameInstance(authorityMongo))); assertThat(mongoConverted.getAuthority(), is(sameInstance(authorityMongo.getAuthority()))); assertThat(mongoConverted.isDefaultForNewUser(), is(sameInstance(authorityMongo.isDefaultForNewUser()))); }