@Test
public void testSaveKeyValue_existing() {
final String key = "foo";
final String value = "bar";
final String newValue = "baz";
PortalPreferenceImpl fooBar = new PortalPreferenceImpl(key, value);
PortalPreferenceImpl fooBarSaved = new PortalPreferenceImpl(key, newValue);
expect(repository.getByKey(key)).andReturn(fooBar).once();
expect(repository.save(fooBar)).andReturn(fooBarSaved).once();
replay(repository);
service.savePreference(key, value);
verify(repository);