### Question:
RegionWidgetApi extends AbstractRestApi { @ResponseBody @RequestMapping(value = "/{regionWidgetId}/collapsed", method = RequestMethod.PUT) public RegionWidget updateRegionWidgetCollapsedStatus(@PathVariable String regionWidgetId, @RequestBody Boolean collapsed) { if (logger.isDebugEnabled()) { logger.debug("POST received to update regionWidget " + regionWidgetId + ": " + collapsed); } return regionWidgetService.saveRegionWidgetCollapsedState(regionWidgetId, collapsed); } @Autowired  RegionWidgetApi(RegionWidgetService regionWidgetService); @ResponseBody @RequestMapping(value = "/{regionWidgetId}/preferences", method = RequestMethod.PUT) RegionWidgetPreferenceListWrapper replaceAllRegionWidgetPreferences(@PathVariable String regionWidgetId,
                                                                               @RequestBody RegionWidgetPreferenceListWrapper
                                                                                       regionWidgetPreferenceListWrapper); @ResponseBody @RequestMapping(value = "/{regionWidgetId}/preferences/{regionWidgetPreferenceName}", method = RequestMethod.PUT) RegionWidgetPreference createOrReplaceRegionWidgetPreference(@PathVariable String regionWidgetId,
                                                                        @PathVariable String regionWidgetPreferenceName,
                                                                        @RequestBody RegionWidgetPreference regionWidgetPreference); @ResponseBody @RequestMapping(value = "/{regionWidgetId}/collapsed", method = RequestMethod.PUT) RegionWidget updateRegionWidgetCollapsedStatus(@PathVariable String regionWidgetId,
                                                          @RequestBody Boolean collapsed);  }### Answer:
@Test public void updateRegionWidgetCollapsedStatus() { final boolean COLLAPSED = true; RegionWidget expectedRegionWidget = new RegionWidgetImpl(VALID_REGION_WIDGET_ID); expectedRegionWidget.setCollapsed(COLLAPSED); expect(regionWidgetService.saveRegionWidgetCollapsedState(VALID_REGION_WIDGET_ID, COLLAPSED)).andReturn(expectedRegionWidget); replay(regionWidgetService); RegionWidget result = regionWidgetApi.updateRegionWidgetCollapsedStatus(VALID_REGION_WIDGET_ID, COLLAPSED); verify(regionWidgetService); assertThat(result, sameInstance(expectedRegionWidget)); }