@Test
public void save_Valid(){
PortalPreference item = new PortalPreferenceImpl();
item.setKey("123");
PortalPreference fromDb = new MongoDbPortalPreference();
((MongoDbPortalPreference)fromDb).setId("123");
PortalPreference converted = new MongoDbPortalPreference();
expect(converter.convert(item, PortalPreference.class)).andReturn(converted);
expect(template.findOne(query(where("key").is("123")), preferenceRepository.CLASS, CollectionNames.PREFERENCE_COLLECTION)).andReturn((MongoDbPortalPreference)fromDb);
template.save(converted, CollectionNames.PREFERENCE_COLLECTION);
expectLastCall();
converter.hydrate(converted, PortalPreference.class);