### Question:
DefaultRegionWidgetService implements RegionWidgetService { @Override public RegionWidget getRegionWidget(String regionWidgetId) { return regionWidgetRepository.get(regionWidgetId); } @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 getRegionWidget_validId() { final RegionWidget VALID_REGION_WIDGET = new RegionWidgetImpl(VALID_REGION_WIDGET_ID); expect(regionWidgetRepository.get(VALID_REGION_WIDGET_ID)).andReturn(VALID_REGION_WIDGET); replay(regionWidgetRepository); assertThat(regionWidgetService.getRegionWidget(VALID_REGION_WIDGET_ID), sameInstance(VALID_REGION_WIDGET)); }
@Test public void getRegionWidget_invalidId() { expect(regionWidgetRepository.get(INVALID_REGION_WIDGET_ID)).andReturn(null); replay(regionWidgetRepository); assertThat(regionWidgetService.getRegionWidget(INVALID_REGION_WIDGET_ID), is(nullValue())); }