expect(regionWidgetRepository.get(VALID_REGION_WIDGET_ID)).andReturn(VALID_REGION_WIDGET).anyTimes();
expect(regionWidgetRepository.save(VALID_REGION_WIDGET)).andReturn(VALID_REGION_WIDGET).anyTimes();
replay(regionWidgetRepository);
//Add and update a preference.
RegionWidgetPreference newPreference = new RegionWidgetPreferenceImpl(null, "age", "30");
RegionWidgetPreference savedNewPreference = regionWidgetService.saveRegionWidgetPreference(VALID_REGION_WIDGET_ID, newPreference);
RegionWidgetPreference updatedPreference = new RegionWidgetPreferenceImpl(null, "color", "purple");
RegionWidgetPreference savedUpdatedPreference = regionWidgetService.saveRegionWidgetPreference(VALID_REGION_WIDGET_ID, updatedPreference);
//Make sure the new and updated preference got mixed in properly with the existing preferences.
List<RegionWidgetPreference> existingPreferences = getTestExistingRegionWidgetPreferences();
existingPreferences.add(savedNewPreference);
existingPreferences.get(0).setValue("purple");