### Question:
DefaultRegionWidgetService implements RegionWidgetService { @Override @Synchronized(discriminator = "'RegionWidget'", id = "#regionWidgetId") @Transactional public List<RegionWidgetPreference> saveRegionWidgetPreferences(String regionWidgetId, List<RegionWidgetPreference> preferences) { RegionWidget regionWidget = this.getValidRegionWidget(regionWidgetId); ModelUtils.normalizeRegionWidgetPreferences(regionWidgetId, preferences); reconcileRegionWidgetPreferences(regionWidget.getPreferences(), preferences, true); return this.saveRegionWidget(regionWidget).getPreferences(); } @Autowired  DefaultRegionWidgetService(RegionWidgetRepository regionWidgetRepository); @Override RegionWidget getRegionWidget(String regionWidgetId); @Override SearchResult<RegionWidget> getAll(); @Override SearchResult<RegionWidget> getLimitedList(int offset, int pageSize); @Override @Transactional RegionWidget saveRegionWidget(RegionWidget regionWidget); @Override @Synchronized(discriminator = "'RegionWidget'", id = "#regionWidgetId") @Transactional List<RegionWidgetPreference> saveRegionWidgetPreferences(String regionWidgetId,
                                                                    List<RegionWidgetPreference> preferences); @Override @Synchronized(discriminator = "'RegionWidget'", id = "#regionWidgetId") @Transactional RegionWidgetPreference saveRegionWidgetPreference(String regionWidgetId, RegionWidgetPreference preference); @Override @Transactional RegionWidget saveRegionWidgetCollapsedState(String regionWidgetId, boolean collapsed);  }### Answer:
@Test public void saveRegionWidgetPreferences() { final RegionWidget VALID_REGION_WIDGET = new RegionWidgetImpl(VALID_REGION_WIDGET_ID); VALID_REGION_WIDGET.setPreferences(getTestExistingRegionWidgetPreferences()); expect(regionWidgetRepository.get(VALID_REGION_WIDGET_ID)).andReturn(VALID_REGION_WIDGET); expect(regionWidgetRepository.save(VALID_REGION_WIDGET)).andReturn(VALID_REGION_WIDGET); replay(regionWidgetRepository); List<RegionWidgetPreference> updatedPreferences = getTestUpdatedRegionWidgetPreferences(); List<RegionWidgetPreference> savedPreferences = regionWidgetService.saveRegionWidgetPreferences(VALID_REGION_WIDGET_ID, updatedPreferences); assertTrue(preferenceCollectionsMatch(updatedPreferences, savedPreferences)); assertTrue(preferencesHaveValidRegionWidgetId(savedPreferences)); }